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/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 3040448736..0000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -# These are supported funding model platforms -github: [kyleconroy] diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index c37d28efe7..34778af7ef 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,12 +9,11 @@ body: description: What version of sqlc are you running? If you don't know, run `sqlc version`. multiple: false options: - - 1.20.0 - - 1.19.1 - - 1.19.0 - - 1.18.0 - - 1.17.2 - - 1.16.0 + - 1.29.0 + - 1.28.0 + - 1.27.0 + - 1.26.0 + - 1.25.0 - Other validations: required: true @@ -49,7 +48,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 a82e3d7e2f..05507b05ba 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@v3 + - uses: actions/checkout@v4 - uses: bufbuild/buf-setup-action@v1 - uses: bufbuild/buf-lint-action@v1 diff --git a/.github/workflows/ci-kotlin.yml b/.github/workflows/ci-kotlin.yml index 5b4f90e4d1..ca53355ad5 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@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 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@v4 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 b0901c2f6a..e0e0b44441 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@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 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@v4 + 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..b502bdcf05 --- /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@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.24.1' + - name: install ./... + run: go install ./... + - uses: actions/checkout@v4 + 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 896d55245e..6e226c0fd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,93 +5,77 @@ on: - main pull_request: jobs: - windows-build: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.20.6' - - run: go build ./... + test: + strategy: + matrix: + # Disabling windows builds while we fix installing PostgreSQL 16 + # os: [ubuntu-22.04, macos-14, windows-2022] + os: [ubuntu-22.04, macos-15] + cgo: ['1', '0'] + # Workaround no native support for conditional matrix items + # https://github.com/orgs/community/discussions/26253#discussioncomment-6745038 + isMain: + - ${{ github.ref == 'refs/heads/main' }} + exclude: + - isMain: false + include: + - os: ubuntu-22.04 + cgo: '1' + - os: ubuntu-22.04 + cgo: '0' + name: test ${{ matrix.os }} cgo=${{ matrix.cgo }} + runs-on: ${{ matrix.os }} - darwin-build: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.20.6' - - run: go build ./... + go-version: '1.24.1' - build: - name: test - 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 - mysql: - image: "mysql/mysql-server:8.0" - env: - MYSQL_DATABASE: mysql - MYSQL_ROOT_HOST: '%' - MYSQL_ROOT_PASSWORD: mysecretpassword - ports: - - 3306:3306 + - name: install gotestsum + run: go install gotest.tools/gotestsum@latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.20.6' + - name: install sqlc-gen-test + run: go install github.com/sqlc-dev/sqlc-gen-test@v0.1.0 - - name: gotestsum - run: go install gotest.tools/gotestsum@latest + - 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: - 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 + CGO_ENABLED: ${{ matrix.cgo }} - name: build internal/endtoend run: go build ./... working-directory: internal/endtoend/testdata + env: + CGO_ENABLED: ${{ matrix.cgo }} + + # Start a PostgreSQL server + - uses: sqlc-dev/action-setup-postgres@master + with: + postgres-version: "16" + id: postgres - - name: report - if: ${{ github.ref == 'refs/heads/main' }} - run: ./scripts/report.sh + # Start a MySQL server + - uses: shogo82148/actions-setup-mysql@v1 + with: + mysql-version: "9.0" + + - name: test ./... + run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./... 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 }} + MYSQL_SERVER_URI: root:@tcp(localhost:3306)/mysql?multiStatements=true&parseTime=true + POSTGRESQL_SERVER_URI: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable + CGO_ENABLED: ${{ matrix.cgo }} vuln_check: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 5 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.20.6' - - run: go install golang.org/x/vuln/cmd/govulncheck@latest - - run: govulncheck ./... + - uses: golang/govulncheck-action@v1 diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index 68f0aecba2..0db460ce08 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@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.20.6' + 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/.gitignore b/.gitignore index 038cc5bde4..39961ebb02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /.idea/ __pycache__ .DS_Store +.*.swp # Devenv .envrc 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 73a00fe6d1..352c3f9ddd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # STEP 1: Build sqlc -FROM golang:1.20.6 AS builder +FROM golang:1.24.4 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 42f2aa38d9..ff48a49f12 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1689175844, - "narHash": "sha256-+ZAcAnogqNXz5P2/NiZonmgUiv+vCC7/swiSepyTulc=", + "lastModified": 1742659231, "owner": "cachix", "repo": "devenv", - "rev": "db59403d5bdad71dce137705ed7cb926681e5f95", + "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": 1689138773, - "narHash": "sha256-NEcJPQfwc1jNDI/ITvieJW2Y+IWdGIYCFHLJl5PGx3o=", + "lastModified": 1742707865, "owner": "NixOS", "repo": "nixpkgs", - "rev": "bf57c599729771cd23054a18c0f3a391ae85e193", + "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": 1688596063, - "narHash": "sha256-9t7RxBiKWHygsqXtiNATTJt4lim/oSYZV3RG8OjDDng=", + "lastModified": 1742649964, "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "c8d18ba345730019c3faf412c96a045ade171895", + "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 92a6f71579..8a25b78d5a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,11 +4,12 @@ # https://devenv.sh/packages/ packages = [ pkgs.buf - pkgs.go + 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 e0b9fc5fa7..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 6b39d46d93..81e8df9339 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.20.0' +release = '1.29.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..6bb8a75ff5 --- /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.29.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 8845585c86..b229f91732 100644 --- a/docs/guides/plugins.md +++ b/docs/guides/plugins.md @@ -1,46 +1,36 @@ -# 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. - - -```json -{ - "version": "2", - "plugins": [ - { - "name": "greeter", - "wasm": { - "url": "https://github.com/sqlc-dev/sqlc-gen-greeter/releases/download/v0.1.0/sqlc-gen-greeter.wasm", - "sha256": "afc486dac2068d741d7a4110146559d12a013fd0286f42a2fc7dcd802424ad07" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "gen", - "plugin": "greeter" - } - ] - } - ] -} +top-level `plugins` map. Any `options` are serialized to a string as JSON and +passed on to the plugin itself. + + +```yaml +version: '2' +plugins: +- name: greeter + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-greeter/releases/download/v0.1.0/sqlc-gen-greeter.wasm + sha256: afc486dac2068d741d7a4110146559d12a013fd0286f42a2fc7dcd802424ad07 +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: greeter + options: + lang: en-US ``` For a complete working example see the following files: @@ -56,38 +46,25 @@ 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. - -```json -{ - "version": "2", - "plugins": [ - { - "name": "jsonb", - "process": { - "cmd": "sqlc-gen-json" - } - } - ], - "sql": [ - { - "schema": "schema.sql", - "queries": "query.sql", - "engine": "postgresql", - "codegen": [ - { - "out": "gen", - "plugin": "jsonb", - "options": { - "indent": " ", - "filename": "codegen.json" - } - } - ] - } - ] -} +top-level `plugins` map. Any `options` are serialized to a string as JSON and +passed on to the plugin itself. + +```yaml +version: '2' +plugins: +- name: jsonb + process: + cmd: sqlc-gen-json +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: jsonb + options: + indent: " " + filename: codegen.json ``` For a complete working example see the following files: @@ -95,3 +72,33 @@ 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 + +By default, plugins do not inherit access to environment variables. Instead, +you can configure access on a per-variable basis. For example, if your plugin +needs the `PATH` environment variable, add `PATH` to the `env` list in the +`plugins` collection. + +```yaml +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: test +plugins: +- name: test + env: + - PATH + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm + sha256: 138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790 +``` + +A variable named `SQLC_VERSION` is always included in the plugin's +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 f24faaf2a0..636434d3af 100644 --- a/docs/guides/using-go-and-pgx.rst +++ b/docs/guides/using-go-and-pgx.rst @@ -66,7 +66,7 @@ Generating the code will now give you pgx-compatible database access methods. .. code-block:: bash - sqlc generate --experimental + sqlc generate ^^^^^^^^^^^^^^^^^^^^^^^^^^ Generated code walkthrough diff --git a/docs/howto/ci-cd.md b/docs/howto/ci-cd.md index 37c75ec5be..78dac4b78e 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.29.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.29.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.29.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.29.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.29.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 44b94b0174..2d51af7fad 100644 --- a/docs/howto/ddl.md +++ b/docs/howto/ddl.md @@ -31,6 +31,7 @@ parsing SQL files. sqlc supports parsing migrations from the following tools: +- [atlas](https://github.com/ariga/atlas) - [dbmate](https://github.com/amacneil/dbmate) - [golang-migrate](https://github.com/golang-migrate/migrate) - [goose](https://github.com/pressly/goose) @@ -51,20 +52,11 @@ sql: out: "tutorial" ``` - -### goose +### atlas ```sql --- +goose Up -CREATE TABLE post ( - id int NOT NULL, - title text, - body text, - PRIMARY KEY(id) -); - --- +goose Down -DROP TABLE post; +-- Create "post" table +CREATE TABLE "public"."post" ("id" integer NOT NULL, "title" text NULL, "body" text NULL, PRIMARY KEY ("id")); ``` ```go @@ -77,41 +69,21 @@ type Post struct { } ``` -### sql-migrate +### dbmate ```sql --- +migrate Up --- SQL in section 'Up' is executed when this migration is applied -CREATE TABLE people (id int); - - --- +migrate Down --- SQL section 'Down' is executed when this migration is rolled back -DROP TABLE people; -``` - -```go -package db - -type People struct { - ID int32 -} -``` - -### tern +-- migrate:up +CREATE TABLE foo (bar INT NOT NULL); -```sql -CREATE TABLE comment (id int NOT NULL, text text NOT NULL); ----- create above / drop below ---- -DROP TABLE comment; +-- migrate:down +DROP TABLE foo; ``` ```go package db -type Comment struct { - ID int32 - Text string +type Foo struct { + Bar int32 } ``` @@ -171,20 +143,90 @@ type Post struct { } ``` -### dbmate +### goose + +**Warning:** +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. + +This doesn't work as intended. + +``` +1_initial.sql +... +9_foo.sql +# this migration file will be parsed BEFORE 9_foo +10_bar.sql +``` + +This worked as intended. + +``` +001_initial.sql +... +009_foo.sql +010_bar.sql +``` ```sql --- migrate:up -CREATE TABLE foo (bar INT NOT NULL); +-- +goose Up +CREATE TABLE post ( + id int NOT NULL, + title text, + body text, + PRIMARY KEY(id) +); --- migrate:down -DROP TABLE foo; +-- +goose Down +DROP TABLE post; ``` ```go package db -type Foo struct { - Bar int32 +type Post struct { + ID int + Title sql.NullString + Body sql.NullString +} +``` + +### sql-migrate + +```sql +-- +migrate Up +-- SQL in section 'Up' is executed when this migration is applied +CREATE TABLE people (id int); + + +-- +migrate Down +-- SQL section 'Down' is executed when this migration is rolled back +DROP TABLE people; +``` + +```go +package db + +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/embedding.md b/docs/howto/embedding.md new file mode 100644 index 0000000000..5ea8cbbc0a --- /dev/null +++ b/docs/howto/embedding.md @@ -0,0 +1,61 @@ +#### Embedding structs + +Embedding allows you to reuse existing model structs in more queries, resulting +in less manual serialization work. First, imagine we have the following schema +with students and test scores. + +```sql +CREATE TABLE students ( + id bigserial PRIMARY KEY, + name text NOT NULL, + age integer NOT NULL +); + +CREATE TABLE test_scores ( + student_id bigint NOT NULL, + score integer NOT NULL, + grade text NOT NULL +); +``` + +We want to select the student record and the scores they got on a test. +Here's how we'd usually do that: + +```sql +-- name: ScoreAndTests :many +SELECT students.*, test_scores.* +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; +``` + +When using Go, sqlc will produce a struct like this: + +```go +type ScoreAndTestsRow struct { + ID int64 + Name string + Age int32 + StudentID int64 + Score int32 + Grade string +} +``` + +With embedding, the struct will contain a model for both tables instead of a +flattened list of columns. + +```sql +-- name: ScoreAndTests :many +SELECT sqlc.embed(students), sqlc.embed(test_scores) +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; +``` + +``` +type ScoreAndTestsRow struct { + Student Student + TestScore TestScore +} +``` \ No newline at end of file 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 4aae9e3364..ae892998ec 100644 --- a/docs/howto/insert.md +++ b/docs/howto/insert.md @@ -122,6 +122,8 @@ func (q *Queries) CreateAuthorAndReturnId(ctx context.Context, arg CreateAuthorA ## Using CopyFrom +### PostgreSQL + PostgreSQL supports the [COPY protocol](https://www.postgresql.org/docs/current/sql-copy.html) that can insert rows a lot faster than sequential inserts. You can use this easily with sqlc: ```sql @@ -146,11 +148,28 @@ func (q *Queries) CreateAuthors(ctx context.Context, arg []CreateAuthorsParams) } ``` +The `:copyfrom` command requires either `pgx/v4` or `pgx/v5`. + +```yaml +version: "2" +sql: + - engine: "postgresql" + queries: "query.sql" + schema: "query.sql" + gen: + go: + package: "db" + sql_package: "pgx/v5" + out: "db" +``` + +### MySQL + MySQL supports a similar feature using [LOAD DATA](https://dev.mysql.com/doc/refman/8.0/en/load-data.html). 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. +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 necessary. Check the [error handling](https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-error-handling) documentation for more information. @@ -165,4 +184,20 @@ INSERT INTO foo (a, b, c, d) VALUES (?, ?, ?, ?); func (q *Queries) InsertValues(ctx context.Context, arg []InsertValuesParams) (int64, error) { ... } +``` + +The `:copyfrom` command requires setting the `sql_package` and `sql_driver` options. + +```yaml +version: "2" +sql: + - engine: "mysql" + queries: "query.sql" + schema: "query.sql" + gen: + go: + package: "db" + sql_package: "database/sql" + sql_driver: "github.com/go-sql-driver/mysql" + out: "db" ``` \ No newline at end of file diff --git a/docs/howto/managed-databases.md b/docs/howto/managed-databases.md new file mode 100644 index 0000000000..745524ea5f --- /dev/null +++ b/docs/howto/managed-databases.md @@ -0,0 +1,101 @@ +# Managed databases + +*Added in v1.22.0* + +`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. + +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. + +Managed databases are under active development, and we're interested in +supporting other use-cases. + +## Configuring managed databases + +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`. +Access to a running database server is required. Add a connection string to the `servers` mapping. + +```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 +``` + +An environment variable can also be used via the `${}` syntax. + +```yaml +version: '2' +servers: +- engine: postgresql + uri: ${DATABASE_URI} +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + database: + managed: true +``` + +## Improving codegen + +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 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) +is a good place to start. It prepares each of your queries against the database +to ensure the query is valid. 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 + rules: + - sqlc/db-prepare +``` 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 new file mode 100644 index 0000000000..5a7fc39610 --- /dev/null +++ b/docs/howto/overrides.md @@ -0,0 +1,94 @@ +# Overriding types + +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, a PostgreSQL UUID type will map +to `UUID` from `github.com/jackc/pgx/pgtype` by default when you use +`pgx/v5`, but you may want `sqlc` to use `UUID` from `github.com/google/uuid` +instead. + +If you'd like `sqlc` to use a different Go type, specify the package import +path and type in the `overrides` list. + +```yaml +version: "2" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + sql_package: "pgx/v5" + overrides: + - db_type: "uuid" + go_type: + import: "github.com/google/uuid" + type: "UUID" +``` + +## The `overrides` list + +Each element in the `overrides` list has the following keys: + +- `db_type`: + - 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`: + - 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`: + - 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 generated code, e.g. `a:"b" x:"y,z"`. + If you want `json` or `db` tags for all fields, use `emit_json_tags` or `emit_db_tags` instead. +- `unsigned`: + - If `true`, sqlc will apply this override when a numeric db_type is unsigned. + Note that this has no effect on `column` overrides. Defaults to `false`. +- `nullable`: + - 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 has no effect on `column` overrides. 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 the same Go type to override in both cases, you'll +need to configure two overrides. + +When generating code, entries using the `column` key will always take precedence over +entries using the `db_type` key. + +### The `go_type` map + +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. +- `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 `true`, generated code will use a pointer to the type rather than the type itself. +- `slice`: + - If `true`, generated code will use a slice of the type rather than the type itself. + +An example: + +```yaml +version: "2" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "db" + sql_package: "pgx/v5" + overrides: + - db_type: "uuid" + go_type: + import: "a/b/v2" + package: "b" + type: "MyType" + pointer: true +``` diff --git a/docs/howto/prepared_query.md b/docs/howto/prepared_query.md index 39655847f4..c6eff3e722 100644 --- a/docs/howto/prepared_query.md +++ b/docs/howto/prepared_query.md @@ -1,5 +1,15 @@ # Preparing queries +If you're using `pgx/v5` you get its +[implicit support](https://github.com/jackc/pgx/wiki/Automatic-Prepared-Statement-Caching) +for prepared statements. No additional `sqlc` configuration is required. + +For other drivers, `sqlc` can give you the option to explicitly use prepared +queries. These prepared queries also work with transactions. + +You'll need to set `emit_prepared_queries` to `true` in your `sqlc` configuration +to generate code similar to the example below. + ```sql CREATE TABLE records ( id SERIAL PRIMARY KEY @@ -10,9 +20,6 @@ SELECT * FROM records WHERE id = $1; ``` -sqlc has an option to use prepared queries. These prepared queries also work -with transactions. - ```go package db @@ -80,4 +87,3 @@ func (q *Queries) GetRecord(ctx context.Context, id int32) (int32, error) { return id, err } ``` - 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 new file mode 100644 index 0000000000..dbc7f94aea --- /dev/null +++ b/docs/howto/rename.md @@ -0,0 +1,99 @@ +# Renaming fields + +Struct field names are generated from column names using a simple algorithm: +split the column name on underscores and capitalize the first letter of each +part. + +``` +account -> Account +spotify_url -> SpotifyUrl +app_id -> AppID +``` + +If you're not happy with a field's generated name, use the `rename` mapping +to pick a new name. The keys are column names and the values are the struct +field name to use. + +```yaml +version: "2" +sql: +- schema: "postgresql/schema.sql" + queries: "postgresql/query.sql" + engine: "postgresql" + gen: + go: + package: "authors" + out: "postgresql" + rename: + spotify_url: "SpotifyURL" +``` + +## 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. + +```sql +CREATE TABLE authors ( + id BIGSERIAL PRIMARY KEY, + name text NOT NULL, + bio text +); +``` + +```go +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} +``` + +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`). + +```yaml +version: '1' +packages: +- path: db + engine: postgresql + schema: query.sql + queries: query.sql +rename: + author: Writer +``` + +```yaml +version: "2" +sql: + - engine: postgresql + queries: query.sql + schema: query.sql +overrides: + go: + rename: + author: Writer +``` + +```go +package db + +import ( + "database/sql" +) + +type Writer struct { + ID int64 + Name string + Bio sql.NullString +} +``` + +## Limitations + +Rename mappings apply to an entire package. Therefore, a column named `foo` and +a table name `foo` can't map to different rename values. \ No newline at end of file diff --git a/docs/howto/select.md b/docs/howto/select.md index cea3900b68..4c5ae269a8 100644 --- a/docs/howto/select.md +++ b/docs/howto/select.md @@ -125,7 +125,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/upload.md b/docs/howto/upload.md deleted file mode 100644 index 0add35c942..0000000000 --- a/docs/howto/upload.md +++ /dev/null @@ -1,57 +0,0 @@ -# Uploading projects - -*This feature requires signing up for [sqlc Cloud](https://app.sqlc.dev), which is currently in beta.* - -Uploading your project ensures that future releases of sqlc do not break your -existing code. Similar to Rust's [crater](https://github.com/rust-lang/crater) -project, uploaded projects are tested against development releases of sqlc to -verify correctness. - -## Add configuration - -After creating a project, add the project ID to your sqlc configuration file. - -```yaml -version: "1" -project: - id: "" -packages: [] -``` - -```json -{ - "version": "1", - "project": { - "id": "" - }, - "packages": [ - ] -} -``` - -You'll also need to create an API 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 will be the exact HTTP request sent by `sqlc`. - -## 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! 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 3ad59b1e18..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 @@ -53,30 +63,38 @@ code ever again. howto/ddl.md howto/structs.md + howto/embedding.md + howto/overrides.md + howto/rename.md - howto/vet.md - howto/ci-cd.md - howto/upload.md +.. toctree:: + :maxdepth: 3 + :caption: sqlc Cloud + :hidden: + + howto/managed-databases.md .. toctree:: :maxdepth: 3 :caption: Reference :hidden: + reference/changelog.md reference/cli.md reference/config.md reference/datatypes.md - reference/query-annotations.md - reference/language-support.rst reference/environment-variables.md - reference/changelog.md + reference/language-support.rst + reference/macros.md + reference/query-annotations.md .. toctree:: :maxdepth: 2 :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 d84c39b646..0d14c21a0d 100644 --- a/docs/overview/install.md +++ b/docs/overview/install.md @@ -14,44 +14,38 @@ 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 ``` -docker pull kjconroy/sqlc +docker pull sqlc/sqlc ``` Run `sqlc` using `docker run`: ``` -docker run --rm -v $(pwd):/src -w /src kjconroy/sqlc generate +docker run --rm -v $(pwd):/src -w /src sqlc/sqlc generate ``` Run `sqlc` using `docker run` in the Command Prompt on Windows (`cmd`): ``` -docker run --rm -v "%cd%:/src" -w /src kjconroy/sqlc generate +docker run --rm -v "%cd%:/src" -w /src sqlc/sqlc generate ``` ## Downloads -Get pre-built binaries for *v1.20.0*: +Get pre-built binaries for *v1.29.0*: -- [Linux](https://downloads.sqlc.dev/sqlc_1.20.0_linux_amd64.tar.gz) -- [macOS](https://downloads.sqlc.dev/sqlc_1.20.0_darwin_amd64.zip) -- [Windows](https://downloads.sqlc.dev/sqlc_1.20.0_windows_amd64.zip) +- [Linux](https://downloads.sqlc.dev/sqlc_1.29.0_linux_amd64.tar.gz) +- [macOS](https://downloads.sqlc.dev/sqlc_1.29.0_darwin_amd64.zip) +- [Windows](https://downloads.sqlc.dev/sqlc_1.29.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 788bccbaab..9adbd0e442 100644 --- a/docs/reference/changelog.md +++ b/docs/reference/changelog.md @@ -1,6 +1,825 @@ # Changelog All notable changes to this project will be documented in this file. +(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 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 +support is available today, with MySQL on the way. + +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](https://dashboard.sqlc.dev). + +Read more in the [managed databases](../howto/managed-databases.md) documentation. + +### Changes + +#### Bug Fixes + +- (codegen/golang) Refactor imports code to match templates (#2709) +- (codegen/golang) Support name type (#2715) +- (wasm) Move Runner struct to shared file (#2725) +- (engine/sqlite) Fix grammer to avoid missing join_constraint (#2732) +- (convert) Support YAML anchors in plugin options (#2733) +- (mysql) Disallow time.Time in mysql :copyfrom queries, not all queries (#2768) +- (engine/sqlite) Fix convert process for VALUES (#2737) + +#### Documentation + +- Clarify nullable override behavior (#2753) +- Add managed databases to sidebar (#2764) +- Pull renaming and type overrides into separate sections (#2774) +- Update the docs banner for managed dbs (#2775) + +#### Features + +- (config) Enables the configuration of copyfrom.go similar to quierer and friends (#2727) +- (vet) Run rules against a managed database (#2751) +- (upload) Point upload command at new endpoint (#2772) +- (compiler) Support DO statements (#2777) + +#### Miscellaneous Tasks + +- (endtoend) Skip tests missing secrets (#2763) +- Skip certain tests on PRs (#2769) + +#### Testing + +- (endtoend) Verify all schemas in endtoend (#2744) +- (examples) Use a hosted database for example testing (#2749) +- (endtoend) Pull region from environment (#2750) + +#### Build + +- (deps) Bump golang from 1.21.0 to 1.21.1 (#2711) +- (deps) Bump google.golang.org/grpc from 1.57.0 to 1.58.1 (#2743) +- (deps) Bump wasmtime-go from v12 to v13 (#2756) +- (windows) Downgrade to mingw 11.2.0 (#2757) +- (deps) Bump urllib3 from 2.0.4 to 2.0.5 in /docs (#2747) +- (deps) Bump google.golang.org/grpc from 1.58.1 to 1.58.2 (#2758) +- (deps) Bump github.com/google/cel-go from 0.18.0 to 0.18.1 (#2778) + +#### Ci + +- 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 + +### Release notes + +This is primarily a bugfix release, along with some documentation and testing improvements. + +#### MySQL engine improvements + +`sqlc` previously didn't know how to parse a `CALL` statement when using the MySQL engine, +which meant it was impossible to use sqlc with stored procedures in MySQL databases. + +Additionally, `sqlc` now supports `IS [NOT] NULL` in queries. And `LIMIT` and `OFFSET` clauses +now work with `UNION`. + +#### SQLite engine improvements + +GitHub user [@orisano](https://github.com/orisano) continues to bring bugfixes and +improvements to `sqlc`'s SQLite engine. See the "Changes" section below for the +full list. + +#### Plugin access to environment variables + +If you're authoring a [sqlc plugin](../guides/plugins.html), you can now configure +sqlc to pass your plugin the values of specific environment variables. + +For example, if your plugin +needs the `PATH` environment variable, add `PATH` to the `env` list in the +`plugins` collection. + +```yaml +version: '2' +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + codegen: + - out: gen + plugin: test +plugins: +- name: test + env: + - PATH + wasm: + url: https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm + sha256: 138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790 +``` + +A variable named `SQLC_VERSION` is always included in the plugin's +environment, set to the version of the `sqlc` executable invoking it. + +### Changes + +#### Bug Fixes + +- Myriad string formatting changes (#2558) +- (engine/sqlite) Support quoted identifier (#2556) +- (engine/sqlite) Fix compile error (#2564) +- (engine/sqlite) Fixed detection of column alias without AS (#2560) +- (ci) Bump go version to 1.20.7 (#2568) +- Remove references to deprecated `--experimental` flag (#2567) +- (postgres) Fixed a problem with array dimensions disappearing when using "ALTER TABLE ADD COLUMN" (#2572) +- Remove GitHub sponsor integration (#2574) +- (docs) Improve discussion of prepared statements support (#2604) +- (docs) Remove multidimensional array qualification in datatypes.md (#2619) +- (config) Go struct tag parsing (#2606) +- (compiler) Fix to not scan children under ast.RangeSubselect when retrieving table listing (#2573) +- (engine/sqlite) Support NOT IN (#2587) +- (codegen/golang) Fixed detection of the used package (#2597) +- (engine/dolphin) Fixed problem that LIMIT OFFSET cannot be used with `UNION ALL` (#2613) +- (compiler) Support identifiers with schema (#2579) +- (compiler) Fix column expansion to work with quoted non-keyword identifiers (#2576) +- (codegen/go) Compare define type in codegen (#2263) (#2578) +- (engine/sqlite) Fix ast when using compound operator (#2673) +- (engine/sqlite) Fix to handle join clauses correctly (#2674) +- (codegen) Use correct Go types for bit strings and cid/oid/tid/xid with pgx/v4 (#2668) +- (endtoend) Ensure all SQL works against PostgreSQL (#2684) + +#### Documentation + +- Update Docker installation instructions (#2552) +- Missing emit_pointers_for_null_types configuration option in version 2 (#2682) (#2683) +- Fix typo (#2697) +- Document sqlc.* macros (#2698) +- (mysql) Document parseTimet=true requirement (#2699) +- Add atlas to the list of supported migration frameworks (#2700) +- Minor updates to insert howto (#2701) + +#### Features + +- (endtoend/testdata) Added two sqlite `CAST` tests and rearranged postgres tests for same (#2551) +- (docs) Add a reference to type overriding in datatypes.md (#2557) +- (engine/sqlite) Support COLLATE for sqlite WHERE clause (#2554) +- (mysql) Add parser support for IS [NOT] NULL (#2651) +- (engine/dolphin) Support CALL statement (#2614) +- (codegen) Allow plugins to access environment variables (#2669) +- (config) Add JSON schema files for configs (#2703) + +#### Miscellaneous Tasks + +- Ignore Vim swap files (#2616) +- Fix typo (#2696) + +#### Refactor + +- (astutils) Remove redundant nil check in `Walk` (#2660) + +#### Build + +- (deps) Bump wasmtime from v8.0.0 to v11.0.0 (#2553) +- (deps) Bump golang from 1.20.6 to 1.20.7 (#2563) +- (deps) Bump chardet from 5.1.0 to 5.2.0 in /docs (#2562) +- (deps) Bump github.com/pganalyze/pg_query_go/v4 (#2583) +- (deps) Bump golang from 1.20.7 to 1.21.0 (#2596) +- (deps) Bump github.com/jackc/pgx/v5 from 5.4.2 to 5.4.3 (#2582) +- (deps) Bump pygments from 2.15.1 to 2.16.1 in /docs (#2584) +- (deps) Bump sphinxcontrib-applehelp from 1.0.4 to 1.0.7 in /docs (#2620) +- (deps) Bump sphinxcontrib-qthelp from 1.0.3 to 1.0.6 in /docs (#2622) +- (deps) Bump github.com/google/cel-go from 0.17.1 to 0.17.6 (#2650) +- (deps) Bump sphinxcontrib-serializinghtml in /docs (#2641) +- Upgrade from Go 1.20 to Go 1.21 (#2665) +- (deps) Bump sphinxcontrib-devhelp from 1.0.2 to 1.0.5 in /docs (#2621) +- (deps) Bump github.com/bytecodealliance/wasmtime-go from v11.0.0 to v12.0.0 (#2666) +- (deps) Bump sphinx-rtd-theme from 1.2.2 to 1.3.0 in /docs (#2670) +- (deps) Bump sphinxcontrib-htmlhelp from 2.0.1 to 2.0.4 in /docs (#2671) +- (deps) Bump github.com/google/cel-go from 0.17.6 to 0.18.0 (#2691) +- (deps) Bump actions/checkout from 3 to 4 (#2694) +- (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 @@ -45,7 +864,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 51c6e6488a..e6e690b6a0 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`: @@ -138,12 +157,20 @@ The `gen` mapping supports the following keys: - If true, parameters are passed as pointers to structs. Defaults to `false`. - `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, 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`: @@ -158,71 +185,20 @@ The `gen` mapping supports the following keys: - Customize the name of the models file. Defaults to `models.go`. - `output_querier_file_name`: - Customize the name of the querier file. Defaults to `querier.go`. +- `output_copyfrom_file_name`: + - Customize the name of the copyfrom file. Defaults to `copyfrom.go`. - `output_files_suffix`: - If specified the suffix will be added to the name of the generated files. - `query_parameter_limit`: - The number of positional arguments that will be generated for Go functions. To always emit a parameter struct, set this to `0`. Defaults to `1`. - `rename`: - - Customize the name of generated struct fields. Explained in detail on the `Renaming fields` section. + - 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. Explained in detail on the `Type overriding` section. - -##### Renaming fields - -Struct field names are generated from column names using a simple algorithm: -split the column name on underscores and capitalize the first letter of each -part. - -``` -account -> Account -spotify_url -> SpotifyUrl -app_id -> AppID -``` - -If you're not happy with a field's generated name, use the `rename` mapping -to pick a new name. The keys are column names and the values are the struct -field name to use. - -```yaml -version: "2" -sql: -- schema: "postgresql/schema.sql" - queries: "postgresql/query.sql" - engine: "postgresql" - gen: - go: - package: "authors" - out: "postgresql" - rename: - spotify_url: "SpotifyURL" -``` - -##### Type overriding - -The default mapping of PostgreSQL/MySQL types to Go types only uses packages outside -the standard library when it must. + - It is a collection of definitions that dictates which types are used to map a database types. -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: "2" -sql: -- schema: "postgresql/schema.sql" - queries: "postgresql/query.sql" - engine: "postgresql" - gen: - go: - package: "authors" - out: "postgresql" - overrides: - - db_type: "uuid" - go_type: "github.com/gofrs/uuid.UUID" -``` +##### overrides -Each mapping of the `overrides` collection has the following keys: +See [Overriding types](../howto/overrides.md) for an in-depth guide to using type overrides. Each mapping of the `overrides` collection 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. @@ -236,9 +212,6 @@ Each mapping of the `overrides` collection has the following keys: - `nullable`: - If `true`, use this type when a column is nullable. Defaults to `false`. -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. - For more complicated import paths, the `go_type` can also be an object with the following keys: - `import`: @@ -252,27 +225,6 @@ For more complicated import paths, the `go_type` can also be an object with the - `slice`: - If set to `true`, generated code will use a slice of the type rather than the type itself. -An example: - -```yaml -version: "2" -sql: -- schema: "postgresql/schema.sql" - queries: "postgresql/query.sql" - engine: "postgresql" - gen: - go: - package: "authors" - out: "postgresql" - overrides: - - db_type: "uuid" - go_type: - import: "a/b/v2" - package: "b" - type: "MyType" - pointer: true -``` - #### kotlin > Removed in v1.17.0 and replaced by the [sqlc-gen-kotlin](https://github.com/sqlc-dev/sqlc-gen-kotlin) plugin. Follow the [migration guide](../guides/migrating-to-sqlc-gen-kotlin) to switch. @@ -316,9 +268,13 @@ Each mapping in the `plugins` collection has the following keys: - `name`: - The name of this plugin. Required +- `env` + - A list of environment variables to pass to the plugin. By default, no environment variables are passed. - `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. @@ -326,13 +282,15 @@ Each mapping in the `plugins` collection has the following keys: - The SHA256 checksum for the downloaded file. ```yaml -version: 2 +version: "2" plugins: - name: "py" wasm: url: "https://github.com/sqlc-dev/sqlc-gen-python/releases/download/v0.16.0-alpha/sqlc-gen-python.wasm" sha256: "428476c7408fd4c032da4ec74e8a7344f4fa75e0f98a5a3302f238283b9b95f2" - name: "js" + env: + - PATH process: cmd: "sqlc-gen-json" ``` @@ -352,7 +310,7 @@ See the [vet](../howto/vet.md) documentation for a list of built-in rules and help writing custom rules. ```yaml -version: 2 +version: "2" sql: - schema: "query.sql" queries: "query.sql" @@ -385,7 +343,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 @@ -419,18 +377,18 @@ sql: gen: go: package: "authors" - out: "mysql + out: "mysql" ``` With the previous configuration, whenever a struct field is generated from a table column that is called `id`, it will generated as `Identifier`. Also, whenever there is a nullable `timestamp with time zone` column in a -Postgres table, it will be generated as `null.Time`. Note that, the mapping for +Postgres table, it will be generated as `null.Time`. Note that the mapping for global type overrides has a field called `engine` that is absent in the regular type overrides. This field is only used when there are multiple definitions -using multiple engines. Otherwise, the value of the `engine` key will be -defaulted to the engine that is currently being used. +using multiple engines. Otherwise, the value of the `engine` key +defaults to the engine that is currently being used. Currently, type overrides and field renaming, both global and regular, are only fully supported in Go. @@ -445,6 +403,7 @@ packages: queries: "./sql/query/" schema: "./sql/schema/" engine: "postgresql" + emit_db_tags: false emit_prepared_queries: true emit_interface: false emit_exact_table_names: false @@ -457,12 +416,15 @@ 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" output_db_file_name: "db.go" output_models_file_name: "models.go" output_querier_file_name: "querier.go" + output_copyfrom_file_name: "copyfrom.go" + query_parameter_limit: 1 ``` ### packages @@ -509,6 +471,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`: @@ -521,6 +485,8 @@ Each mapping in the `packages` collection has the following keys: - Customize the name of the models file. Defaults to `models.go`. - `output_querier_file_name`: - Customize the name of the querier file. Defaults to `querier.go`. +- `output_copyfrom_file_name`: + - Customize the name of the copyfrom file. Defaults to `copyfrom.go`. - `output_files_suffix`: - If specified the suffix will be added to the name of the generated files. - `query_parameter_limit`: @@ -556,6 +522,10 @@ Each override document has the following keys: - `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 @@ -588,7 +558,7 @@ overrides: #### Package Level Overrides -Overrides can be configured globally, as demonstrated in the previous sections, or they can be configured on a per-package which +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 diff --git a/docs/reference/datatypes.md b/docs/reference/datatypes.md index 7637bc9d30..bb3d8168b6 100644 --- a/docs/reference/datatypes.md +++ b/docs/reference/datatypes.md @@ -1,9 +1,15 @@ # Datatypes +`sqlc` attempts to make reasonable default choices when mapping internal +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.md#type-overriding) in your `sqlc` config file. + ## Arrays PostgreSQL [arrays](https://www.postgresql.org/docs/current/arrays.html) are -materialized as Go slices. Currently, the `pgx/v5` sql package only supports multidimensional arrays. +materialized as Go slices. ```sql CREATE TABLE places ( @@ -21,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, @@ -52,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 @@ -86,7 +96,7 @@ type Store struct { ## Null For structs, null values are represented using the appropriate type from the -`database/sql` or `pgx` package. +`database/sql` or `pgx` package. ```sql CREATE TABLE authors ( @@ -148,8 +158,8 @@ For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to stor ## JSON By default, sqlc will generate the `[]byte`, `pgtype.JSON` or `json.RawMessage` for JSON column type. -But if you use the `pgx/v5` sql package then you can specify a some struct instead of default type. -The `pgx` implementation will marshall/unmarshall the struct automatically. +But if you use the `pgx/v5` sql package then you can specify a struct instead of default type. +The `pgx` implementation will marshal/unmarshal the struct automatically. ```go package dto @@ -193,3 +203,118 @@ type Book struct { Data *dto.BookData } ``` + +## 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 you sqlc config file. + +## 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. +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. + +```sql +-- Multipolygons in British National Grid (epsg:27700) +create table shapes( + id serial, + name varchar, + geom geometry(Multipolygon, 27700) +); + +-- name: GetShapes :many +SELECT * FROM shapes; +``` + +```json +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "query.sql", + "queries": "query.sql" + } + ], + "overrides": [ + { + "db_type": "geometry", + "go_type": "github.com/twpayne/go-geom.MultiPolygon" + }, + { + "db_type": "geometry", + "go_type": "github.com/twpayne/go-geom.MultiPolygon", + "nullable": true + } + ] +} +``` diff --git a/docs/reference/language-support.rst b/docs/reference/language-support.rst index 37a4e192b6..6826c32a7a 100644 --- a/docs/reference/language-support.rst +++ b/docs/reference/language-support.rst @@ -1,29 +1,45 @@ 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 +======== ================================= =============== =============== =============== + +.. _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 +.. _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 Future language support ************************ -- `C# `_ -- `TypeScript `_ diff --git a/docs/reference/macros.md b/docs/reference/macros.md new file mode 100644 index 0000000000..36c7c92420 --- /dev/null +++ b/docs/reference/macros.md @@ -0,0 +1,119 @@ +# Macros + +## `sqlc.arg` + +Attach a name to a parameter in a SQL query. This macro expands to an +engine-specific parameter placeholder. The name of the parameter is noted and +used during code generation. + +```sql +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE lower(name) = sqlc.arg(name); + +-- >>> EXPANDS TO >>> + +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE lower(name) = ?; +``` + +See more examples in [Naming parameters](../howto/named_parameters). + +## `sqlc.embed` + +Embedding allows you to reuse existing model structs in more queries, resulting +in less manual serialization work. First, imagine we have the following schema +with students and test scores. + +```sql +CREATE TABLE students ( + id bigserial PRIMARY KEY, + name text, + age integer +); + +CREATE TABLE test_scores ( + student_id bigint, + score integer, + grade text +); +``` + +```sql +-- name: GetStudentAndScore :one +SELECT sqlc.embed(students), sqlc.embed(test_scores) +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; + +-- >>> EXPANDS TO >>> + +-- name: GetStudentAndScore :one +SELECT students.*, test_scores.* +FROM students +JOIN test_scores ON test_scores.student_id = students.id +WHERE students.id = $1; +``` + +The Go method will return a struct with a field for the `Student` and field for +the test `TestScore` instead of each column existing on the struct. + +```go +type GetStudentAndScoreRow struct { + Student Student + TestScore TestScore +} + +func (q *Queries) GetStudentAndScore(ctx context.Context, id int64) (GetStudentAndScoreRow, error) { + // ... +} +``` + +See a full example in [Embedding structs](../howto/embedding). + +## `sqlc.narg` + +The same as `sqlc.arg`, but always marks the parameter as nullable. + +```sql +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE lower(name) = sqlc.narg(name); + +-- >>> EXPANDS TO >>> + +-- name: GetAuthorByName :one +SELECT * +FROM authors +WHERE LOWER(name) = ?; +``` + +See more examples in [Naming parameters](../howto/named_parameters). + +## `sqlc.slice` + +For drivers that do not support passing slices to the IN operator, the +`sqlc.slice` macro generates a dynamic query at runtime with the correct +number of parameters. + +```sql +/* name: SelectStudents :many */ +SELECT * FROM students +WHERE age IN (sqlc.slice("ages")) + +-- >>> EXPANDS TO >>> + +/* name: SelectStudents :many */ +SELECT id, name, age FROM authors +WHERE age IN (/*SLICE:ages*/?) +``` + +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.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 ad76be023e..3bda4367e3 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 -chardet==5.1.0 +Babel==2.17.0 +Jinja2==3.1.6 +MarkupSafe==3.0.2 +Pygments==2.19.1 +Sphinx==7.4.7 +certifi==2025.1.31 +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.15.1 -pyparsing==3.1.1 -pytz==2023.3 -recommonmark==0.7.1 -requests==2.31.0 +myst-parser==4.0.1 +packaging==25.0 +pyparsing==3.2.3 +pytz==2025.2 +requests==2.32.3 snowballstemmer==2.2.0 -Sphinx==6.2.1 sphinx-favicon==1.0.1 -sphinx-rtd-theme==1.2.2 -sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-serializinghtml==1.1.5 -sphinxcontrib-htmlhelp==2.0.1 +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.3 -urllib3==2.0.4 +sphinxcontrib-qthelp==2.0.0 +sphinxcontrib-serializinghtml==2.0.0 +sphinxext-rediraffe==0.2.7 +urllib3==2.4.0 diff --git a/docs/tutorials/getting-started-mysql.md b/docs/tutorials/getting-started-mysql.md index cefce611f1..1c436e7e6a 100644 --- a/docs/tutorials/getting-started-mysql.md +++ b/docs/tutorials/getting-started-mysql.md @@ -3,30 +3,44 @@ 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: 1 -packages: - - path: "tutorial" - name: "tutorial" - engine: "mysql" - schema: "schema.sql" +version: "2" +sql: + - engine: "mysql" 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 ( @@ -59,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 @@ -78,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 @@ -89,15 +110,15 @@ import ( "log" "reflect" - "tutorial.sqlc.dev/app/tutorial" - _ "github.com/go-sql-driver/mysql" + + "tutorial.sqlc.dev/app/tutorial" ) func run() error { ctx := context.Background() - db, err := sql.Open("mysql", "user:password@/dbname") + db, err := sql.Open("mysql", "user:password@/dbname?parseTime=true") if err != nil { return err } @@ -144,12 +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. + +## 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 59d4f8061f..e2b0a86b13 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.20.0 +// sqlc v1.29.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 f8dd35243a..c665426db7 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.20.0 +// sqlc v1.29.0 package authors diff --git a/examples/authors/mysql/query.sql.go b/examples/authors/mysql/query.sql.go index d70696b25c..c157ebd28b 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.20.0 +// sqlc v1.29.0 // source: query.sql package authors diff --git a/examples/authors/postgresql/db.go b/examples/authors/postgresql/db.go index 59d4f8061f..7cdd263bbf 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.20.0 +// sqlc v1.29.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 150c118614..0fdd8824be 100644 --- a/examples/authors/postgresql/db_test.go +++ b/examples/authors/postgresql/db_test.go @@ -1,34 +1,39 @@ //go:build examples -// +build examples package authors import ( "context" - "database/sql" "testing" - "github.com/sqlc-dev/sqlc/internal/sqltest" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestAuthors(t *testing.T) { - sdb, cleanup := sqltest.PostgreSQL(t, []string{"schema.sql"}) - defer cleanup() - ctx := context.Background() - db := New(sdb) + uri := local.PostgreSQL(t, []string{"schema.sql"}) + db, err := pgx.Connect(ctx, uri) + if err != nil { + t.Fatal(err) + } + defer db.Close(ctx) + + q := New(db) // list all authors - authors, err := db.ListAuthors(ctx) + authors, err := q.ListAuthors(ctx) if err != nil { t.Fatal(err) } t.Log(authors) // create an author - insertedAuthor, err := db.CreateAuthor(ctx, CreateAuthorParams{ + 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) @@ -36,7 +41,7 @@ func TestAuthors(t *testing.T) { t.Log(insertedAuthor) // get the author we just inserted - fetchedAuthor, err := db.GetAuthor(ctx, insertedAuthor.ID) + fetchedAuthor, err := q.GetAuthor(ctx, insertedAuthor.ID) if err != nil { t.Fatal(err) } diff --git a/examples/authors/postgresql/models.go b/examples/authors/postgresql/models.go index f8dd35243a..a786490b52 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.20.0 +// sqlc v1.29.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 209f1a43f7..1974fcad9e 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.20.0 +// sqlc v1.29.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 d43fb976d6..57f2319ea1 100644 --- a/examples/authors/sqlc.yaml +++ b/examples/authors/sqlc.yaml @@ -1,22 +1,29 @@ version: '2' +cloud: + project: "01HAQMMECEYQYKFJN8MP16QC41" sql: -- schema: postgresql/schema.sql +- name: postgresql + schema: postgresql/schema.sql queries: postgresql/query.sql engine: postgresql database: - uri: postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/authors + 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 @@ -24,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: @@ -41,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 59d4f8061f..e2b0a86b13 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.20.0 +// sqlc v1.29.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 f8dd35243a..c665426db7 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.20.0 +// sqlc v1.29.0 package authors diff --git a/examples/authors/sqlite/query.sql.go b/examples/authors/sqlite/query.sql.go index d70696b25c..c157ebd28b 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.20.0 +// sqlc v1.29.0 // source: query.sql package authors diff --git a/examples/batch/postgresql/batch.go b/examples/batch/postgresql/batch.go index f73459107f..086a002485 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.20.0 +// sqlc v1.29.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 a9d5a209a7..d5a442b596 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.20.0 +// sqlc v1.29.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 9395e4c20c..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,14 +7,23 @@ import ( "testing" "time" - "github.com/sqlc-dev/sqlc/internal/sqltest" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBatchBooks(t *testing.T) { - db, cleanup := sqltest.PostgreSQLPgx(t, []string{"schema.sql"}) - defer cleanup() + uri := local.PostgreSQL(t, []string{"schema.sql"}) ctx := context.Background() + + db, err := pgx.Connect(ctx, uri) + if err != nil { + t.Fatal(err) + } + defer db.Close(ctx) + dq := New(db) // create an author @@ -24,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{ @@ -107,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 8a46a232b4..027ff37c26 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.20.0 +// sqlc v1.29.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 cca674479e..ed7075878d 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.20.0 +// sqlc v1.29.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 f74e6548ba..d856deeedd 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.20.0 +// sqlc v1.29.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 dfd7ac8099..2f6b9a9e7e 100644 --- a/examples/batch/sqlc.json +++ b/examples/batch/sqlc.json @@ -1,5 +1,8 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { "path": "postgresql", @@ -8,15 +11,18 @@ "queries": "postgresql/query.sql", "engine": "postgresql", "database": { - "uri": "postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/batch" + "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 881637f15d..20879ba690 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.20.0 +// sqlc v1.29.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 3737155951..883b5286b5 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.20.0 +// sqlc v1.29.0 package booktest diff --git a/examples/booktest/mysql/query.sql.go b/examples/booktest/mysql/query.sql.go index 2c70abdc13..6181c3bb8c 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.20.0 +// sqlc v1.29.0 // source: query.sql package booktest diff --git a/examples/booktest/postgresql/db.go b/examples/booktest/postgresql/db.go index 881637f15d..fcbe1cd6e3 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.20.0 +// sqlc v1.29.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 440198d0e7..ae71593852 100644 --- a/examples/booktest/postgresql/db_test.go +++ b/examples/booktest/postgresql/db_test.go @@ -1,5 +1,4 @@ //go:build examples -// +build examples package booktest @@ -8,14 +7,21 @@ import ( "testing" "time" - "github.com/sqlc-dev/sqlc/internal/sqltest" + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgtype" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func TestBooks(t *testing.T) { - db, cleanup := sqltest.PostgreSQL(t, []string{"schema.sql"}) - defer cleanup() - 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(ctx) + dq := New(db) // create an author @@ -25,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) } @@ -33,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", @@ -100,7 +106,7 @@ func TestBooks(t *testing.T) { } // tx commit - err = tx.Commit() + err = tx.Commit(ctx) if err != nil { t.Fatal(err) } @@ -125,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) @@ -143,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 2d415dd677..802ef764be 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.20.0 +// sqlc v1.29.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 a094e67715..bb9f258125 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.20.0 +// sqlc v1.29.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 8220d36010..b0b0d71d01 100644 --- a/examples/booktest/sqlc.json +++ b/examples/booktest/sqlc.json @@ -1,5 +1,8 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { "name": "booktest", @@ -7,8 +10,12 @@ "schema": "postgresql/schema.sql", "queries": "postgresql/query.sql", "engine": "postgresql", + "sql_package": "pgx/v5", "database": { - "uri": "postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/booktest" + "uri": "${VET_TEST_EXAMPLES_POSTGRES_BOOKTEST}" + }, + "analyzer": { + "database": false }, "rules": [ "sqlc/db-prepare" @@ -21,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" @@ -41,4 +48,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/examples/booktest/sqlite/db.go b/examples/booktest/sqlite/db.go index 881637f15d..20879ba690 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.20.0 +// sqlc v1.29.0 package booktest diff --git a/examples/booktest/sqlite/db_test.go b/examples/booktest/sqlite/db_test.go index d1da918bab..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() @@ -146,7 +146,7 @@ func TestBooks(t *testing.T) { t.Fatal(err) } for _, ab := range res { - t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tag: '%v'\n", ab.BookID, ab.Title, ab.Name, ab.Isbn, ab.Tag) + t.Logf("Book %d: '%s', Author: '%s', ISBN: '%s' Tag: '%v'\n", ab.BookID, ab.Title, ab.Name.String, ab.Isbn, ab.Tag) } // TODO: call say_hello(varchar) diff --git a/examples/booktest/sqlite/models.go b/examples/booktest/sqlite/models.go index a6863455de..49429fc589 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.20.0 +// sqlc v1.29.0 package booktest diff --git a/examples/booktest/sqlite/query.sql.go b/examples/booktest/sqlite/query.sql.go index 2786ab392d..c1f6f4f57e 100644 --- a/examples/booktest/sqlite/query.sql.go +++ b/examples/booktest/sqlite/query.sql.go @@ -1,12 +1,13 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 // source: query.sql package booktest import ( "context" + "database/sql" "strings" "time" ) @@ -26,7 +27,7 @@ WHERE tag IN (/*SLICE:tags*/?) type BooksByTagsRow struct { BookID int64 Title string - Name string + Name sql.NullString Isbn string Tag string } diff --git a/examples/jets/postgresql/db.go b/examples/jets/postgresql/db.go index 90116ae4a8..3235067366 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.20.0 +// sqlc v1.29.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 29c375fff5..72ed009f4e 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.20.0 +// sqlc v1.29.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 ed617ef8db..7b7f9a1399 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.20.0 +// sqlc v1.29.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 f8c5ef1ba7..8dfa0df777 100644 --- a/examples/jets/sqlc.json +++ b/examples/jets/sqlc.json @@ -1,5 +1,8 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { "path": "postgresql", @@ -7,8 +10,12 @@ "schema": "postgresql/schema.sql", "queries": "postgresql/query-building.sql", "engine": "postgresql", + "sql_package": "pgx/v5", "database": { - "uri": "postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/jets" + "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 c9ee8c50c9..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.20.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 baa0a610df..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.20.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 6c10454c07..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.20.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 55113ca7e9..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.20.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 81138a156b..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.20.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 ecd34dfa71..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.20.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 4c90c1612e..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.20.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 b242812812..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.20.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 0ec3ad9ba3..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.20.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 ace0787695..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.20.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 ed7896e816..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.20.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 ebf4701c09..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.20.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 27cf98d638..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.20.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 1da4c535b2..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.20.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 ad8a34ba8f..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.20.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 65db04a19c..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.20.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 743a3a49cb..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.20.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 ab265cdd79..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.20.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 c77b484a49..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.20.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 bf92938c23..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.20.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 aeb0c82d65..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.20.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 1a0a699fad..0d21716e73 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.20.0 +// sqlc v1.29.0 // source: city.sql package ondeck diff --git a/examples/ondeck/mysql/db.go b/examples/ondeck/mysql/db.go index 7735dee80e..e2a5dd8883 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.20.0 +// sqlc v1.29.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 d1211a2f60..508a79a3ed 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.20.0 +// sqlc v1.29.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 0068310d95..f70ac57cc6 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.20.0 +// sqlc v1.29.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 bf35de7d36..7c9d664427 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.20.0 +// sqlc v1.29.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 1447a30054..c87815a348 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.20.0 +// sqlc v1.29.0 // source: city.sql package ondeck diff --git a/examples/ondeck/postgresql/db.go b/examples/ondeck/postgresql/db.go index 7735dee80e..e2a5dd8883 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.20.0 +// sqlc v1.29.0 package ondeck diff --git a/examples/ondeck/postgresql/db_test.go b/examples/ondeck/postgresql/db_test.go index fd16a49484..6d2fba6714 100644 --- a/examples/ondeck/postgresql/db_test.go +++ b/examples/ondeck/postgresql/db_test.go @@ -1,15 +1,16 @@ //go:build examples -// +build examples package ondeck import ( "context" + "database/sql" "testing" - "github.com/sqlc-dev/sqlc/internal/sqltest" - "github.com/google/go-cmp/cmp" + _ "github.com/lib/pq" + + "github.com/sqlc-dev/sqlc/internal/sqltest/local" ) func runOnDeckQueries(t *testing.T, q *Queries) { @@ -124,10 +125,14 @@ func runOnDeckQueries(t *testing.T, q *Queries) { func TestPrepared(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.PostgreSQL(t, []string{"schema"}) - defer cleanup() + uri := local.PostgreSQL(t, []string{"schema"}) + db, err := sql.Open("postgres", 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) } @@ -138,8 +143,12 @@ func TestPrepared(t *testing.T) { func TestQueries(t *testing.T) { t.Parallel() - sdb, cleanup := sqltest.PostgreSQL(t, []string{"schema"}) - defer cleanup() + uri := local.PostgreSQL(t, []string{"schema"}) + db, err := sql.Open("postgres", 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/postgresql/models.go b/examples/ondeck/postgresql/models.go index fdb802b220..efd5575df5 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.20.0 +// sqlc v1.29.0 package ondeck diff --git a/examples/ondeck/postgresql/querier.go b/examples/ondeck/postgresql/querier.go index 9456d1c395..0681661637 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.20.0 +// sqlc v1.29.0 package ondeck diff --git a/examples/ondeck/postgresql/venue.sql.go b/examples/ondeck/postgresql/venue.sql.go index 9bc1541700..5f3b4daf03 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.20.0 +// sqlc v1.29.0 // source: venue.sql package ondeck diff --git a/examples/ondeck/sqlc.json b/examples/ondeck/sqlc.json index 61862a2a06..7b97328b3f 100644 --- a/examples/ondeck/sqlc.json +++ b/examples/ondeck/sqlc.json @@ -1,5 +1,8 @@ { "version": "1", + "cloud": { + "project": "01HAQMMECEYQYKFJN8MP16QC41" + }, "packages": [ { "path": "postgresql", @@ -7,8 +10,12 @@ "schema": "postgresql/schema", "queries": "postgresql/query", "engine": "postgresql", + "sql_package": "database/sql", "database": { - "uri": "postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/ondeck" + "uri": "${VET_TEST_EXAMPLES_POSTGRES_ONDECK}" + }, + "analyzer": { + "database": false }, "rules": [ "sqlc/db-prepare" @@ -18,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" @@ -50,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 1a0a699fad..0d21716e73 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.20.0 +// sqlc v1.29.0 // source: city.sql package ondeck diff --git a/examples/ondeck/sqlite/db.go b/examples/ondeck/sqlite/db.go index 7735dee80e..e2a5dd8883 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.20.0 +// sqlc v1.29.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 cfea547cae..d20a091b8f 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.20.0 +// sqlc v1.29.0 package ondeck diff --git a/examples/ondeck/sqlite/querier.go b/examples/ondeck/sqlite/querier.go index 0068310d95..f70ac57cc6 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.20.0 +// sqlc v1.29.0 package ondeck diff --git a/examples/ondeck/sqlite/venue.sql.go b/examples/ondeck/sqlite/venue.sql.go index 47b6bdf3d7..6e5bebfdb1 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.20.0 +// sqlc v1.29.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 5749eb3f53..0000000000 --- a/examples/python/src/authors/models.py +++ /dev/null @@ -1,12 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 767fd66b45..0000000000 --- a/examples/python/src/authors/query.py +++ /dev/null @@ -1,112 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 f20d0178a4..0000000000 --- a/examples/python/src/booktest/models.py +++ /dev/null @@ -1,30 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 988b695957..0000000000 --- a/examples/python/src/booktest/query.py +++ /dev/null @@ -1,211 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 eff0f36acf..0000000000 --- a/examples/python/src/jets/models.py +++ /dev/null @@ -1,31 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 6ff99c18aa..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.20.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 f6d9f09b3c..0000000000 --- a/examples/python/src/ondeck/city.py +++ /dev/null @@ -1,76 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 447bf460e5..0000000000 --- a/examples/python/src/ondeck/models.py +++ /dev/null @@ -1,35 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 53952a24d1..0000000000 --- a/examples/python/src/ondeck/venue.py +++ /dev/null @@ -1,159 +0,0 @@ -# Code generated by sqlc. DO NOT EDIT. -# versions: -# sqlc v1.20.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 35febc855a..3f400daed9 100644 --- a/go.mod +++ b/go.mod @@ -1,60 +1,73 @@ module github.com/sqlc-dev/sqlc -go 1.20 +go 1.23.0 + +toolchain go1.24.1 require ( - github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230321174746-8dcc6526cfb1 - github.com/bytecodealliance/wasmtime-go/v8 v8.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.17.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.2 + github.com/fatih/structtag v1.2.0 + github.com/go-sql-driver/mysql v1.9.2 + github.com/google/cel-go v0.25.0 + github.com/google/go-cmp v0.7.0 + github.com/jackc/pgx/v4 v4.18.3 + github.com/jackc/pgx/v5 v5.7.4 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.1 + 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 - golang.org/x/sync v0.3.0 - google.golang.org/grpc v1.57.0 - google.golang.org/protobuf v1.31.0 + github.com/spf13/cobra v1.9.1 + github.com/spf13/pflag v1.0.6 + 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.13.0 + google.golang.org/grpc v1.72.0 + google.golang.org/protobuf v1.36.6 gopkg.in/yaml.v3 v3.0.1 + modernc.org/sqlite v1.37.0 ) require ( - google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect -) - -require ( - github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect - github.com/golang/protobuf v1.5.3 // indirect + cel.dev/expr v0.23.1 // 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/pingcap/log v0.0.0-20210906054005-afc726e70354 // indirect - github.com/pingcap/tidb/parser v0.0.0-20220725134311-c80026e61f00 - github.com/pkg/errors v0.9.1 // indirect - github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // 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/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 - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.7.0 // indirect - go.uber.org/zap v1.19.1 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.0.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.27.0 // indirect + golang.org/x/crypto v0.36.0 // indirect + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect + golang.org/x/net v0.38.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + modernc.org/libc v1.62.1 // indirect + modernc.org/mathutil v1.7.1 // indirect + modernc.org/memory v1.9.1 // indirect ) diff --git a/go.sum b/go.sum index 3635e3a846..64414ebb7d 100644 --- a/go.sum +++ b/go.sum @@ -1,51 +1,51 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +cel.dev/expr v0.23.1 h1:K4KOtPCJQjVggkARsjG9RWXP6O4R73aHeJMa/dmCQQg= +cel.dev/expr v0.23.1/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/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +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/bytecodealliance/wasmtime-go/v8 v8.0.0 h1:jP4sqm2PHgm3+eQ50zCoCdIyQFkIL/Rtkw6TT8OYPFI= -github.com/bytecodealliance/wasmtime-go/v8 v8.0.0/go.mod h1:tgazNLU7xSC2gfRAM8L4WyE+dgs5yp9FF5/tGebEQyM= 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.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/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.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU= +github.com/go-sql-driver/mysql v1.9.2/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.17.1 h1:s2151PDGy/eqpCI80/8dl4VL3xTkqI/YubXLXCFw0mw= -github.com/google/cel-go v0.17.1/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= -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.25.0 h1:jsFw9Fhn+3y2kBbltZR4VEz5xKkcIFRPDnuEzAGv5GY= +github.com/google/cel-go v0.25.0/go.mod h1:hjEb6r5SuOSlhCHmFoLzu8HGCERvIsDAbxDAyNU/MmI= 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= @@ -58,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= @@ -76,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= @@ -91,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.2 h1:u1gmGDwbdRUZiwisBm/Ky2M14uQyUP65bG8+20nnyrg= -github.com/jackc/pgx/v5 v5.4.2/go.mod h1:q6iHT8uDNXWiFNOlRqJzBTaSH3+2xCXkokxHZC5qWFY= +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.4 h1:9wKznZrhWa2QiHL+NjTSPP6yjl3451BX3imWDnokYlg= +github.com/jackc/pgx/v5 v5.7.4/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ= 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= @@ -106,10 +106,12 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -121,24 +123,28 @@ 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.1 h1:id/vuyIQccb9f6Yx3pzH5l4QYrxE3v6/m8RPlgMrprc= -github.com/pganalyze/pg_query_go/v4 v4.2.1/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.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/log v0.0.0-20210906054005-afc726e70354 h1:SvWCbCPh1YeHd9yQLksvJYAgft6wLTY1aNG81tpyscQ= -github.com/pingcap/log v0.0.0-20210906054005-afc726e70354/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4= -github.com/pingcap/tidb/parser v0.0.0-20220725134311-c80026e61f00 h1:aDC/yAGx/jPEyrX+UPKV3GWg+4A4yG8ifuP6jBEhDi0= -github.com/pingcap/tidb/parser v0.0.0-20220725134311-c80026e61f00/go.mod h1:wjvp+T3/T9XYt0nKqGX3Kc1AKuyUcfno6LTc6b2A6ew= +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/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= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/riza-io/grpc-go v0.2.0 h1:2HxQKFVE7VuYstcJ8zqpN84VnAoJ4dCL6YFhJewNcHQ= github.com/riza-io/grpc-go v0.2.0/go.mod h1:2bDvR9KkKC3KhtlSHfR3dAXjUMT86kg4UfWFyVGWqi8= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -154,52 +160,72 @@ github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXY 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.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/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 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +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/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.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= 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= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= 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.1.11-0.20210813005559-691160354723 h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4= -go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +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= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= 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.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= -go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +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= @@ -209,32 +235,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.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= 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.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -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.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 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= @@ -246,27 +265,19 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.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.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= 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= @@ -275,44 +286,62 @@ 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.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= 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-20230525234035-dd9d682886f9 h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -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= +google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a h1:nwKuGPlUAt+aR+pcrkfFRrTU1BVrSmYyYMxYbUIVHr0= +google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a/go.mod h1:3kWAYMk1I75K4vykHtKt2ycnOgpA6974V7bREqbsenU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ= +google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= +google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= 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.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 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-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= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +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.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= 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.25.2 h1:T2oH7sZdGvTaie0BRNFbIYsabzCxUQg8nLqCdQ2i0ic= +modernc.org/cc/v4 v4.25.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= +modernc.org/ccgo/v4 v4.25.1 h1:TFSzPrAGmDsdnhT9X2UrcPMI3N/mJ9/X9ykKXwLhDsU= +modernc.org/ccgo/v4 v4.25.1/go.mod h1:njjuAYiPflywOOrm3B7kCB444ONP5pAVr8PIEoE0uDw= +modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= +modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= +modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= +modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/libc v1.62.1 h1:s0+fv5E3FymN8eJVmnk0llBe6rOxCu/DEU+XygRbS8s= +modernc.org/libc v1.62.1/go.mod h1:iXhATfJQLjG3NWy56a6WVU73lWOcdYVxsvwCgoPljuo= +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.9.1 h1:V/Z1solwAVmMW1yttq3nDdZPJqV1rM05Ccq6KMSZ34g= +modernc.org/memory v1.9.1/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.37.0 h1:s1TMe7T3Q3ovQiK2Ouz4Jwh7dw4ZDqbebSDTlSJdfjI= +modernc.org/sqlite v1.37.0/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM= +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/metadata.go b/internal/bundler/metadata.go deleted file mode 100644 index 18d41e9f68..0000000000 --- a/internal/bundler/metadata.go +++ /dev/null @@ -1,16 +0,0 @@ -package bundler - -import ( - "runtime" - - "github.com/sqlc-dev/sqlc/internal/info" -) - -func projectMetadata() ([][2]string, error) { - return [][2]string{ - {"sqlc_version", info.Version}, - {"go_version", runtime.Version()}, - {"goos", runtime.GOOS}, - {"goarch", runtime.GOARCH}, - }, nil -} diff --git a/internal/bundler/multipart.go b/internal/bundler/multipart.go index dd4eed10a1..b1d1925fde 100644 --- a/internal/bundler/multipart.go +++ b/internal/bundler/multipart.go @@ -1,80 +1,40 @@ package bundler import ( - "io" - "mime/multipart" "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 writeInputs(w *multipart.Writer, file string, conf *config.Config) 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 err - } - for _, file := range files { - refs[file] = struct{}{} - } - } - } - - for file, _ := range refs { - if err := addPart(w, file); err != nil { - return err - } - } - - params, err := projectMetadata() +func readFiles(dir string, paths []string) ([]*pb.File, error) { + files, err := sqlpath.Glob(paths) if err != nil { - return err + return nil, err } - params = append(params, [2]string{"project_id", conf.Project.ID}) - for _, val := range params { - if err = w.WriteField(val[0], val[1]); err != nil { - return err + var out []*pb.File + for _, file := range files { + f, err := readFile(dir, file) + if err != nil { + return nil, err } + out = append(out, f) } - return nil + return out, nil } -func addPart(w *multipart.Writer, file string) error { - h, err := os.Open(file) - if err != nil { - return err - } - defer h.Close() - part, err := w.CreateFormFile("inputs", file) +func readFile(dir string, path string) (*pb.File, error) { + rel, err := filepath.Rel(dir, path) if err != nil { - return err + return nil, err } - _, err = io.Copy(part, h) + blob, err := os.ReadFile(path) if err != nil { - return err - } - return nil -} - -func writeOutputs(w *multipart.Writer, dir string, output map[string]string) error { - for filename, contents := range output { - rel, err := filepath.Rel(dir, filename) - if err != nil { - return err - } - part, err := w.CreateFormFile("outputs", rel) - if err != nil { - return err - } - if _, err := io.WriteString(part, contents); err != nil { - return err - } + return nil, err } - return nil + return &pb.File{ + Name: rel, + Contents: blob, + }, nil } diff --git a/internal/bundler/upload.go b/internal/bundler/upload.go index 0d1d508f9a..49e3b44a4c 100644 --- a/internal/bundler/upload.go +++ b/internal/bundler/upload.go @@ -1,28 +1,51 @@ package bundler import ( - "bytes" "context" + "errors" "fmt" - "io" - "mime/multipart" - "net/http" - "net/http/httputil" + "log/slog" "os" + "strings" + + "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, @@ -30,70 +53,112 @@ func NewUploader(configPath, dir string, conf *config.Config) *Uploader { } func (up *Uploader) Validate() error { - if up.config.Project.ID == "" { - return fmt.Errorf("project.id is not set") + if up.config.Cloud.Project == "" { + return ErrNoProject + } + if up.config.Cloud.AuthToken == "" { + return ErrNoAuthToken } - if up.token == "" { - return fmt.Errorf("SQLC_AUTH_TOKEN environment variable is not set") + if up.client == nil { + client, err := quickdb.NewClientFromConfig(up.config.Cloud) + if err != nil { + return fmt.Errorf("client init failed: %w", err) + } + up.client = client } return nil } -func (up *Uploader) buildRequest(ctx context.Context, result map[string]string) (*http.Request, error) { - body := bytes.NewBuffer([]byte{}) - w := multipart.NewWriter(body) - if err := writeInputs(w, up.configPath, up.config); 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) } - if err := writeOutputs(w, up.dir, result); err != nil { + 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 } - if err := w.Close(); err != nil { - return nil, err + res := &pb.UploadArchiveRequest{ + SqlcVersion: info.Version, + Config: conf, + Tags: tags, + Annotations: annotate(), } - req, err := http.NewRequest("POST", "https://api.sqlc.dev/upload", body) - if err != nil { - return nil, err + 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, + }, + }) } - // Set sqlc-version header - req.Header.Set("Content-Type", w.FormDataContentType()) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", up.token)) - return req.WithContext(ctx), nil + 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 } - dump, err := httputil.DumpRequest(req, true) - if err != nil { - return err + 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)) + } } - os.Stdout.Write(dump) 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 } - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - return err - } - if resp.StatusCode >= 400 { - body, err := io.ReadAll(resp.Body) - defer resp.Body.Close() - if err != nil { - return fmt.Errorf("upload error: endpoint returned non-200 status code: %d", resp.StatusCode) - } - return fmt.Errorf("upload error: %d: %s", resp.StatusCode, string(body)) + if _, err := up.client.UploadArchive(ctx, req); err != nil { + return fmt.Errorf("upload error: %w", err) } return nil } 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 3548ce0df8..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,16 +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("no-database", false, "disable database connections (default: false)") + rootCmd.PersistentFlags().Bool("remote", false, "enable remote execution (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) @@ -134,21 +136,21 @@ var initCmd = &cobra.Command{ } type Env struct { - DryRun bool - Debug opts.Debug - 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(), - 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", } } @@ -188,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) } @@ -209,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", @@ -230,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 @@ -273,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 b38e730986..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 } - if conf.Cloud.Project != "" && !e.NoRemote { + // 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) + } + // The output file must be contained inside the output directory + if !strings.HasPrefix(filename, absout) { + return fmt.Errorf("invalid file output path: %s", filename) } - return nil, fmt.Errorf("errored") + 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,12 +349,15 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re switch { case plug.Process != nil: handler = &process.Runner{ - Cmd: plug.Process.Cmd, + Cmd: plug.Process.Cmd, + Env: plug.Env, + Format: plug.Process.Format, } case plug.WASM != nil: handler = &wasm.Runner{ URL: plug.WASM.URL, SHA256: plug.WASM.SHA256, + Env: plug.Env, } default: return "", nil, fmt.Errorf("unsupported plugin type") @@ -398,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 7265f87511..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,127 +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, - 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 { @@ -228,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, }) } @@ -298,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 da0189e9d9..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,15 +20,18 @@ 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" "github.com/sqlc-dev/sqlc/internal/shfmt" + "github.com/sqlc-dev/sqlc/internal/sql/sqlpath" "github.com/sqlc-dev/sqlc/internal/vet" ) @@ -34,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", @@ -44,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) } @@ -56,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 @@ -100,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 { @@ -134,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 { @@ -324,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 } @@ -369,24 +379,73 @@ 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 + 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) 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 +func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, func() error, error) { + cleanup := func() error { + return nil + } + + if s.Database == nil { + panic("fetch database URI called with nil database") + } + if !s.Database.Managed { + uri, err := c.DSN(s.Database.URI) + return uri, cleanup, err + } + + if c.Client == nil { + // FIXME: Eventual race condition + client := dbmanager.NewClient(c.Conf.Servers) + c.Client = client + } + + var ddl []string + files, err := sqlpath.Glob(s.Schema) + if err != nil { + return "", cleanup, err + } + for _, schema := range files { + contents, err := os.ReadFile(schema) + if err != nil { + return "", cleanup, fmt.Errorf("read file: %w", err) } + ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents))) } - return shfmt.Replace(dsn, c.Envmap), nil + + 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) + } + + 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 uri, cleanup, nil +} + +func (c *checker) DSN(dsn string) (string, error) { + return c.Replacer.Replace(dsn), nil } func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { @@ -419,13 +478,19 @@ 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, err := c.DSN(s.Database.URI) + dburl, cleanup, err := c.fetchDatabaseUri(ctx, s) if err != nil { return err } + defer func() { + if err := cleanup(); err != nil { + fmt.Fprintf(c.Stderr, "error cleaning up: %s\n", err) + } + }() + switch s.Engine { case config.EnginePostgreSQL: conn, err := pgx.Connect(ctx, dburl) @@ -451,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) } @@ -472,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{ @@ -485,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 75dddca9da..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" ) @@ -34,15 +35,15 @@ func TagsToString(tags map[string]string) string { } tagParts := make([]string, 0, len(tags)) for key, val := range tags { - tagParts = append(tagParts, fmt.Sprintf("%s:\"%s\"", key, val)) + tagParts = append(tagParts, fmt.Sprintf("%s:%q", key, val)) } sort.Strings(tagParts) 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 7cd0a8dccd..ac91cc537f 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 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.CodeGenRequest, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { +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,23 +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" - // TODO(Jille): Make this configurable. + 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 { @@ -243,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 } @@ -269,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{ @@ -303,7 +355,10 @@ func usesBatch(queries []Query) bool { func checkNoTimesForMySQLCopyFrom(queries []Query) error { for _, q := range queries { - for _, f := range q.Arg.Fields() { + if q.Cmd != metadata.CmdCopyFrom { + continue + } + for _, f := range q.Arg.CopyFromMySQLFields() { if f.Type == "time.Time" { return fmt.Errorf("values with a timezone are not yet supported") } @@ -329,6 +384,9 @@ func filterUnusedStructs(enums []Enum, structs []Struct, queries []Query) ([]Enu if query.Ret.IsStruct() { for _, field := range query.Ret.Struct.Fields { keepTypes[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..0d72621efe 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -3,16 +3,18 @@ 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.Matches(col.Table, req.Catalog.DefaultSchema) { // Different table. continue } @@ -31,9 +33,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 +45,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 +53,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,12 +63,13 @@ func goType(req *plugin.CodeGenRequest, col *plugin.Column) string { return typ } -func goInnerType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray // 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 } @@ -76,11 +81,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 94088ed7fa..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 { @@ -21,9 +21,9 @@ type ImportSpec struct { func (s ImportSpec) String() string { if s.ID != "" { - return fmt.Sprintf("%s \"%s\"", s.ID, s.Path) + return fmt.Sprintf("%s %q", s.ID, s.Path) } else { - return fmt.Sprintf("\"%s\"", s.Path) + return fmt.Sprintf("%q", s.Path) } } @@ -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,23 +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.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 { @@ -116,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"}) } } @@ -152,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{}) @@ -160,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{}{} @@ -181,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{}{} @@ -196,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 } @@ -215,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 } @@ -232,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}) { @@ -242,8 +257,8 @@ func (i *importer) interfaceImports() fileImports { return true } } - if !q.Arg.isEmpty() { - if hasPrefixIgnoringSliceAndPointerPrefix(q.Arg.Type(), name) { + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } @@ -257,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{}{} @@ -296,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() { @@ -310,15 +325,17 @@ func (i *importer) queryImports(filename string) fileImports { return true } } - if !q.Arg.isEmpty() { - if q.Arg.EmitStruct() { - for _, f := range q.Arg.Struct.Fields { - if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { - return true - } + // Check the fields of the argument struct if it's emitted + if q.Arg.EmitStruct() { + for _, f := range q.Arg.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true } } - if hasPrefixIgnoringSliceAndPointerPrefix(q.Arg.Type(), name) { + } + // Check the argument pairs inside the method definition + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } @@ -377,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) } @@ -395,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) { @@ -412,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{}{} @@ -430,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() { @@ -444,15 +465,15 @@ func (i *importer) batchImports() fileImports { return true } } - if !q.Arg.isEmpty() { - if q.Arg.EmitStruct() { - for _, f := range q.Arg.Struct.Fields { - if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { - return true - } + if q.Arg.EmitStruct() { + for _, f := range q.Arg.Struct.Fields { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { + return true } } - if hasPrefixIgnoringSliceAndPointerPrefix(q.Arg.Type(), name) { + } + for _, f := range q.Arg.Pairs() { + if hasPrefixIgnoringSliceAndPointerPrefix(f.Type, name) { return true } } @@ -462,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 88% rename from internal/config/go_type.go rename to internal/codegen/golang/opts/go_type.go index 078360e57d..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" @@ -6,6 +6,8 @@ import ( "go/types" "regexp" "strings" + + "github.com/fatih/structtag" ) type GoType struct { @@ -14,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 { @@ -26,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 { @@ -75,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 == "" { @@ -169,18 +179,14 @@ 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) - fields := strings.Fields(string(s)) - for _, f := range fields { - k, v, ok := strings.Cut(f, ":") - if !ok { - return nil, fmt.Errorf("Failed to parse Go struct tag: no colon in field %q", f) - } - if len(v) < 2 || v[0] != '"' || v[len(v)-1] != '"' { - return nil, fmt.Errorf("Failed to parse Go struct tag: missing quotes around value in field %q", f) - } - m[k] = v[1 : len(v)-1] // trim quotes off of v + tags, err := structtag.Parse(string(s)) + if err != nil { + return nil, err + } + for _, tag := range tags.Tags() { + m[tag.Key] = tag.Value() } return m, 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 81% rename from internal/config/override.go rename to internal/codegen/golang/opts/override.go index f2337a79de..4a1b6f2903 100644 --- a/internal/config/override.go +++ b/internal/codegen/golang/opts/override.go @@ -1,4 +1,4 @@ -package config +package opts import ( "fmt" @@ -6,7 +6,7 @@ import ( "strings" "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 +22,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 +36,47 @@ 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) 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 +92,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 +116,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 +148,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 +158,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 ae3e1278ac..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 { @@ -256,20 +257,20 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { } return "sql.NullTime" - case "text", "pg_catalog.varchar", "pg_catalog.bpchar", "string", "citext": + case "text", "pg_catalog.varchar", "pg_catalog.bpchar", "string", "citext", "name": if notNull { return "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,16 +335,15 @@ 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 { return "int64" } @@ -354,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{}" @@ -364,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{}" @@ -372,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{}" @@ -382,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{}" @@ -390,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{}" @@ -400,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{}" @@ -408,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{}" @@ -418,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{}" @@ -426,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{}" @@ -436,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{}" @@ -444,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{}" @@ -454,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{}" @@ -467,25 +467,47 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "interface{}" case "bit", "varbit", "pg_catalog.bit", "pg_catalog.varbit": - if driver.IsPGX() { + if driver == opts.SQLDriverPGXV5 { return "pgtype.Bits" } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.Varbit" + } - case "box": - if driver.IsPGX() { - return "pgtype.Box" + case "cid": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Uint32" + } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.CID" } - case "cid", "oid": - if driver.IsPGX() { + case "oid": + if driver == opts.SQLDriverPGXV5 { return "pgtype.Uint32" } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.OID" + } case "tid": if driver.IsPGX() { return "pgtype.TID" } + case "xid": + if driver == opts.SQLDriverPGXV5 { + return "pgtype.Uint32" + } + if driver == opts.SQLDriverPGXV4 { + return "pgtype.XID" + } + + case "box": + if driver.IsPGX() { + return "pgtype.Box" + } + case "circle": if driver.IsPGX() { return "pgtype.Circle" @@ -516,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{}" @@ -542,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 4fbecaffb3..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 @@ -38,21 +39,41 @@ func (v QueryValue) isEmpty() bool { return v.Typ == "" && v.Name == "" && v.Struct == nil } +type Argument struct { + Name string + Type string +} + func (v QueryValue) Pair() string { - if v.isEmpty() { - return "" + var out []string + for _, arg := range v.Pairs() { + out = append(out, arg.Name+" "+arg.Type) } + return strings.Join(out, ",") +} - var out []string +// Return the argument name and type for query methods. Should only be used in +// the context of method arguments. +func (v QueryValue) Pairs() []Argument { + if v.isEmpty() { + return nil + } if !v.EmitStruct() && v.IsStruct() { + var out []Argument for _, f := range v.Struct.Fields { - out = append(out, toLowerCase(f.Name)+" "+f.Type) + out = append(out, Argument{ + Name: escape(toLowerCase(f.Name)), + Type: f.Type, + }) } - - return strings.Join(out, ",") + return out + } + return []Argument{ + { + Name: escape(v.Name), + Type: v.DefineType(), + }, } - - return v.Name + " " + v.DefineType() } func (v QueryValue) SlicePair() string { @@ -82,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 { @@ -109,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))) } } } @@ -146,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, ", ") + "}" } @@ -202,7 +227,11 @@ func (v QueryValue) Scan() string { return "\n" + strings.Join(out, ",\n") } -func (v QueryValue) Fields() []Field { +// Deprecated: This method does not respect the Emit field set on the +// QueryValue. It's used by the go-sql-driver-mysql/copyfromCopy.tmpl and should +// not be used other places. +func (v QueryValue) CopyFromMySQLFields() []Field { + // fmt.Printf("%#v\n", v) if v.Struct != nil { return v.Struct.Fields } 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 b3e01f2bb7..e21475b148 100644 --- a/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl +++ b/internal/codegen/golang/templates/go-sql-driver-mysql/copyfromCopy.tmpl @@ -4,16 +4,16 @@ var readerHandlerSequenceFor{{.MethodName}} uint32 = 1 func convertRowsFor{{.MethodName}}(w *io.PipeWriter, {{.Arg.SlicePair}}) { - e := mysqltsv.NewEncoder(w, {{ len .Arg.Fields }}, nil) + e := mysqltsv.NewEncoder(w, {{ len .Arg.CopyFromMySQLFields }}, nil) for _, row := range {{.Arg.Name}} { {{- with $arg := .Arg }} -{{- range $arg.Fields}} +{{- range $arg.CopyFromMySQLFields}} {{- if eq .Type "string"}} - e.AppendString({{if eq (len $arg.Fields) 1}}row{{else}}row.{{.Name}}{{end}}) -{{- else if eq .Type "[]byte"}} - e.AppendBytes({{if eq (len $arg.Fields) 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.Fields) 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 1736fa11f7..59a88c880a 100644 --- a/internal/codegen/golang/templates/pgx/queryCode.tmpl +++ b/internal/codegen/golang/templates/pgx/queryCode.tmpl @@ -33,10 +33,15 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ( func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) { row := q.db.QueryRow(ctx, {{.ConstantName}}, {{.Arg.Params}}) {{- end}} - {{- if ne .Arg.Pair .Ret.Pair }} + {{- if or (ne .Arg.Pair .Ret.Pair) (ne .Arg.DefineType .Ret.DefineType) }} 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 6eca49cd17..1e7f4e22a4 100644 --- a/internal/codegen/golang/templates/stdlib/queryCode.tmpl +++ b/internal/codegen/golang/templates/stdlib/queryCode.tmpl @@ -24,10 +24,15 @@ type {{.Ret.Type}} struct { {{- range .Ret.Struct.Fields}} {{end -}} func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}) ({{.Ret.DefineType}}, error) { {{- template "queryCodeStdExec" . }} - {{- if ne .Arg.Pair .Ret.Pair }} + {{- if or (ne .Arg.Pair .Ret.Pair) (ne .Arg.DefineType .Ret.DefineType) }} 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 8ea2fd2d20..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,24 +45,39 @@ 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) { - switch c.conf.Engine { - case config.EngineMySQL: - return "`" + ident + "`" - default: - return "\"" + 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 } +func (c *Compiler) quote(x string) string { + switch c.conf.Engine { + case config.EngineMySQL: + return "`" + x + "`" + default: + return "\"" + x + "\"" + } +} + func (c *Compiler) expandStmt(qc *QueryCatalog, raw *ast.RawStmt, node ast.Node) ([]source.Edit, error) { tables, err := c.sourceTables(qc, node) if err != nil { @@ -125,25 +149,55 @@ 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)) + } } - oldString := strings.Join(old, ".") + + var oldString string + var oldFunc func(string) int // use the sqlc.embed string instead if embed, ok := qc.embeds.Find(ref); ok { oldString = embed.Orig() + } else { + oldFunc = func(s string) int { + length := 0 + for i, o := range old { + if hasSeparator := i > 0; hasSeparator { + length++ + } + if strings.HasPrefix(s[length:], o) { + length += len(o) + } else if quoted := c.quote(o); strings.HasPrefix(s[length:], quoted) { + length += len(quoted) + } else { + length += len(o) + } + } + return length + } } edits = append(edits, source.Edit{ Location: res.Location - raw.StmtLocation, Old: oldString, + OldFunc: oldFunc, 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 39b254cc39..dbdbe252b3 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,14 +114,8 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er if isUnion { return c.outputColumns(qc, n.Larg) } - 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 @@ -157,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}) @@ -173,12 +166,17 @@ func (c *Compiler) outputColumns(qc *QueryCatalog, node ast.Node) ([]*Column, er name = *res.Name } notNull := false - if n.Boolop == ast.BoolExprTypeNot && len(n.Args.Items) == 1 { - sublink, ok := n.Args.Items[0].(*ast.SubLink) - if ok && sublink.SubLinkType == ast.EXISTS_SUBLINK { + if len(n.Args.Items) == 1 { + switch n.Boolop { + case ast.BoolExprTypeIsNull, ast.BoolExprTypeIsNotNull: notNull = true - if name == "" { - name = "not_exists" + case ast.BoolExprTypeNot: + sublink, ok := n.Args.Items[0].(*ast.SubLink) + if ok && sublink.SubLinkType == ast.EXISTS_SUBLINK { + notNull = true + if name == "" { + name = "not_exists" + } } } } @@ -397,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 } @@ -417,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: @@ -454,6 +455,23 @@ func isTableRequired(n ast.Node, col *Column, prior int) int { return tableNotFound } +type tableVisitor struct { + list ast.List +} + +func (r *tableVisitor) Visit(n ast.Node) astutils.Visitor { + switch n.(type) { + case *ast.RangeVar, *ast.RangeFunction: + r.list.Items = append(r.list.Items, n) + return r + case *ast.RangeSubselect: + r.list.Items = append(r.list.Items, n) + return nil + default: + return r + } +} + // Compute the output columns for a statement. // // Return an error if column references are ambiguous @@ -461,7 +479,7 @@ func isTableRequired(n ast.Node, col *Column, prior int) int { // 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 @@ -470,14 +488,9 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro Items: []ast.Node{n.Relation}, } case *ast.SelectStmt: - list = astutils.Search(n.FromClause, func(node ast.Node) bool { - switch node.(type) { - case *ast.RangeVar, *ast.RangeSubselect, *ast.RangeFunction: - return true - default: - return false - } - }) + var tv tableVisitor + astutils.Walk(&tv, n.FromClause) + list = &tv.list case *ast.TruncateStmt: list = astutils.Search(n.Relations, func(node ast.Node) bool { _, ok := node.(*ast.RangeVar) @@ -489,19 +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.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: @@ -528,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 { @@ -570,6 +608,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 @@ -595,30 +636,37 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) ([]*Column, error) { parts := stringSlice(node.Fields) - var name, alias string + var schema, name, alias string switch { case len(parts) == 1: name = parts[0] case len(parts) == 2: alias = parts[0] name = parts[1] + case len(parts) == 3: + schema = parts[0] + alias = parts[1] + name = parts[2] default: return nil, fmt.Errorf("unknown number of fields: %d", len(parts)) } var cols []*Column var found int for _, t := range tables { + if schema != "" && t.Rel.Schema != schema { + continue + } if alias != "" && t.Rel.Name != alias { 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, @@ -639,14 +687,14 @@ func outputColumnRefs(res *ast.ResTarget, tables []*Table, node *ast.ColumnRef) if found == 0 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column \"%s\" does not exist", name), + Message: fmt.Sprintf("column %q does not exist", name), Location: res.Location, } } if found > 1 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column reference \"%s\" is ambiguous", name), + Message: fmt.Sprintf("column reference %q is ambiguous", name), Location: res.Location, } } @@ -702,14 +750,14 @@ func findColumnForRef(ref *ast.ColumnRef, tables []*Table, targetList *ast.List) if found == 0 { return &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column reference \"%s\" not found", name), + Message: fmt.Sprintf("column reference %q not found", name), Location: ref.Location, } } if found > 1 { return &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column reference \"%s\" is ambiguous", name), + Message: fmt.Sprintf("column reference %q is ambiguous", name), Location: ref.Location, } } diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 8354bd340a..681d291122 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -1,62 +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.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 @@ -64,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 { @@ -126,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 7e4127d5ee..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))) } @@ -188,7 +210,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, if !located { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("table alias \"%s\" does not exist", alias), + Message: fmt.Sprintf("table alias %q does not exist", alias), Location: node.Location, } } @@ -231,14 +253,14 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, if found == 0 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column \"%s\" does not exist", key), + Message: fmt.Sprintf("column %q does not exist", key), Location: node.Location, } } if found > 1 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column reference \"%s\" is ambiguous", key), + Message: fmt.Sprintf("column reference %q is ambiguous", key), Location: node.Location, } } @@ -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) @@ -471,7 +502,7 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, } else { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("column \"%s\" does not exist", key), + Message: fmt.Sprintf("column %q does not exist", key), Location: n.Location, } } @@ -580,27 +611,26 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, }) } } - } else { - fmt.Println("------------------------") } if found == 0 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("396: column \"%s\" does not exist", key), + Message: fmt.Sprintf("396: column %q does not exist", key), Location: location, } } if found > 1 { return nil, &sqlerr.Error{ Code: "42703", - Message: fmt.Sprintf("in same name column reference \"%s\" is ambiguous", key), + Message: fmt.Sprintf("in same name column reference %q is ambiguous", key), Location: location, } } default: - fmt.Printf("unsupported reference type: %T", 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 1d3df66aae..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,33 +57,40 @@ const ( ) type Config struct { - Version string `json:"version" yaml:"version"` - Project Project `json:"project" yaml:"project"` - 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 Project struct { - ID string `json:"id" yaml:"id"` +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 { - URI string `json:"uri" yaml:"uri"` + URI string `json:"uri" yaml:"uri"` + Managed bool `json:"managed" yaml:"managed"` } 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"` + 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"` @@ -95,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"` @@ -114,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 @@ -124,40 +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"` - 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 { @@ -169,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 @@ -198,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 @@ -224,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/convert/convert.go b/internal/config/convert/convert.go index 555b0f027c..2bd0550886 100644 --- a/internal/config/convert/convert.go +++ b/internal/config/convert/convert.go @@ -59,6 +59,9 @@ func gen(n *yaml.Node) (interface{}, error) { } + case yaml.AliasNode: + return gen(n.Alias) + default: return nil, fmt.Errorf("unknown yaml value: %s (%s)", n.Value, n.Tag) diff --git a/internal/config/convert/convert_test.go b/internal/config/convert/convert_test.go new file mode 100644 index 0000000000..11e62ba571 --- /dev/null +++ b/internal/config/convert/convert_test.go @@ -0,0 +1,47 @@ +package convert + +import ( + "testing" + + "gopkg.in/yaml.v3" +) + +const anchor = ` +sql: + - schema: query.sql + queries: query.sql + engine: postgresql + codegen: + - out: gateway/src/gateway/services/organization + plugin: py + options: &base-options + query_parameter_limit: 1 + package: gateway + output_models_file_name: null + emit_module: true + emit_generators: false + emit_async: true + + - schema: query.sql + queries: query.sql + engine: postgresql + codegen: + - out: gateway/src/gateway/services/project + plugin: py + options: *base-options +` + +type config struct { + SQL yaml.Node `yaml:"sql"` +} + +func TestAlias(t *testing.T) { + var a config + err := yaml.Unmarshal([]byte(anchor), &a) + if err != nil { + t.Fatal(err) + } + if _, err := gen(&a.SQL); err != nil { + t.Fatal(err) + } +} 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 4ad96ea9eb..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"` - Project Project `json:"project" yaml:"project"` 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"` - 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 @@ -131,7 +118,6 @@ func (c *V1GenerateSettings) ValidateGlobalOverrides() error { func (c *V1GenerateSettings) Translate() Config { conf := Config{ Version: c.Version, - Project: c.Project, Cloud: c.Cloud, Rules: c.Rules, } @@ -142,40 +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, 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 new file mode 100644 index 0000000000..a0667a7c9c --- /dev/null +++ b/internal/config/v_one.json @@ -0,0 +1,346 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "const": "1" + }, + "cloud": { + "type": "object", + "properties": { + "organization": { + "type": "string" + }, + "project": { + "type": "string" + }, + "hostname": { + "type": "string" + } + } + }, + "packages": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "engine" + ], + "properties": { + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "schema": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "queries": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "database": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "managed": { + "type": "boolean" + } + } + }, + "analyzer": { + "type": "object", + "properties": { + "database": { + "type": "boolean" + } + } + }, + "strict_function_checks": { + "type": "boolean" + }, + "strict_order_by": { + "type": "boolean" + }, + "emit_interface": { + "type": "boolean" + }, + "emit_json_tags": { + "type": "boolean" + }, + "json_tags_id_uppercase": { + "type": "boolean" + }, + "emit_db_tags": { + "type": "boolean" + }, + "emit_prepared_queries": { + "type": "boolean" + }, + "emit_exact_table_names": { + "type": "boolean" + }, + "emit_empty_slices": { + "type": "boolean" + }, + "emit_exported_queries": { + "type": "boolean" + }, + "emit_result_struct_pointers": { + "type": "boolean" + }, + "emit_params_struct_pointers": { + "type": "boolean" + }, + "emit_methods_with_db_argument": { + "type": "boolean" + }, + "emit_pointers_for_null_types": { + "type": "boolean" + }, + "emit_enum_valid_method": { + "type": "boolean" + }, + "emit_all_enum_values": { + "type": "boolean" + }, + "emit_sql_as_comment": { + "type": "boolean" + }, + "build_tags": { + "type": "string" + }, + "json_tags_case_style": { + "type": "string" + }, + "package": { + "type": "string" + }, + "out": { + "type": "string" + }, + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + }, + "sql_package": { + "type": "string" + }, + "sql_driver": { + "type": "string" + }, + "output_batch_file_name": { + "type": "string" + }, + "output_db_file_name": { + "type": "string" + }, + "output_models_file_name": { + "type": "string" + }, + "output_querier_file_name": { + "type": "string" + }, + "output_copyfrom_file_name": { + "type": "string" + }, + "output_files_suffix": { + "type": "string" + }, + "inflection_exclude_table_names": { + "type": "array", + "items": { + "type": "string" + } + }, + "query_parameter_limit": { + "type": "integer" + }, + "omit_unused_structs": { + "type": "boolean" + }, + "rules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + } + }, + "rename": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "rule": { + "type": "string" + }, + "message": { + "type": "string" + } + } + } + } +} 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 new file mode 100644 index 0000000000..acf914997d --- /dev/null +++ b/internal/config/v_two.json @@ -0,0 +1,448 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "const": "2" + }, + "cloud": { + "type": "object", + "properties": { + "organization": { + "type": "string" + }, + "project": { + "type": "string" + }, + "hostname": { + "type": "string" + } + } + }, + "sql": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "engine" + ], + "properties": { + "name": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "schema": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "queries": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "database": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "managed": { + "type": "boolean" + } + } + }, + "analyzer": { + "type": "object", + "properties": { + "database": { + "type": "boolean" + } + } + }, + "strict_function_checks": { + "type": "boolean" + }, + "strict_order_by": { + "type": "boolean" + }, + "gen": { + "type": "object", + "properties": { + "go": { + "type": "object", + "properties": { + "emit_interface": { + "type": "boolean" + }, + "emit_json_tags": { + "type": "boolean" + }, + "json_tags_id_uppercase": { + "type": "boolean" + }, + "emit_db_tags": { + "type": "boolean" + }, + "emit_prepared_queries": { + "type": "boolean" + }, + "emit_exact_table_names": { + "type": "boolean" + }, + "emit_empty_slices": { + "type": "boolean" + }, + "emit_exported_queries": { + "type": "boolean" + }, + "emit_result_struct_pointers": { + "type": "boolean" + }, + "emit_params_struct_pointers": { + "type": "boolean" + }, + "emit_methods_with_db_argument": { + "type": "boolean" + }, + "emit_pointers_for_null_types": { + "type": "boolean" + }, + "emit_enum_valid_method": { + "type": "boolean" + }, + "emit_all_enum_values": { + "type": "boolean" + }, + "emit_sql_as_comment": { + "type": "boolean" + }, + "build_tags": { + "type": "string" + }, + "json_tags_case_style": { + "type": "string" + }, + "package": { + "type": "string" + }, + "out": { + "type": "string" + }, + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + } + }, + "rename": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + }, + "sql_package": { + "type": "string" + }, + "sql_driver": { + "type": "string" + }, + "output_batch_file_name": { + "type": "string" + }, + "output_db_file_name": { + "type": "string" + }, + "output_models_file_name": { + "type": "string" + }, + "output_querier_file_name": { + "type": "string" + }, + "output_copyfrom_file_name": { + "type": "string" + }, + "output_files_suffix": { + "type": "string" + }, + "inflection_exclude_table_names": { + "type": "array", + "items": { + "type": "string" + } + }, + "query_parameter_limit": { + "type": "integer" + }, + "omit_unused_structs": { + "type": "boolean" + } + }, + "json": { + "type": "object", + "properties": { + "out": { + "type": "string" + }, + "indent": { + "type": "string" + }, + "filename": { + "type": "string" + } + } + } + } + }, + "codegen": { + "type": "array", + "items": { + "type": "object", + "properties": { + "out": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "options": { + "type": "object" + } + } + } + }, + "rules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "overrides": { + "type": "object", + "properties": { + "go": { + "type": "object", + "properties": { + "overrides": { + "type": "array", + "items": { + "type": "object", + "properties": { + "go_type": { + "oneOf": [ + { + "type": "object", + "properties": { + "import": { + "type": "string" + }, + "package": { + "type": "string" + }, + "type": { + "type": "string" + }, + "pointer": { + "type": "boolean" + }, + "slice": { + "type": "boolean" + }, + "spec": { + "type": "string" + }, + "builtin": { + "type": "boolean" + } + } + }, + { + "type": "string" + } + ] + }, + "go_struct_tag": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "engine": { + "enum": [ + "postgresql", + "mysql", + "sqlite" + ] + }, + "nullable": { + "type": "boolean" + }, + "unsigned": { + "type": "boolean" + }, + "column": { + "type": "string" + } + } + } + }, + "rename": { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + } + } + } + } + }, + "plugins": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, + "process": { + "type": "object", + "properties": { + "cmd": { + "type": "string" + } + } + }, + "wasm": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "sha256": { + "type": "string" + } + } + } + } + } + }, + "rules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "rule": { + "type": "string" + }, + "message": { + "type": "string" + } + } + } + } + } +} diff --git a/internal/config/validate.go b/internal/config/validate.go index e0e056fd65..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 == "" { - return fmt.Errorf("invalid config: database must have a non-empty URI") + if sql.Database.URI == "" && !sql.Database.Managed { + 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/core/fqn.go b/internal/core/fqn.go deleted file mode 100644 index ebdcba8c11..0000000000 --- a/internal/core/fqn.go +++ /dev/null @@ -1,9 +0,0 @@ -package core - -// TODO: This is the last struct left over from the old architecture. Figure -// out how to remove it at some point -type FQN struct { - Catalog string - Schema string - Rel string -} 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 new file mode 100644 index 0000000000..bed9333743 --- /dev/null +++ b/internal/endtoend/ddl_test.go @@ -0,0 +1,61 @@ +package main + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/sqltest/local" +) + +func TestValidSchema(t *testing.T) { + for _, replay := range FindTests(t, "testdata", "base") { + replay := replay // https://golang.org/doc/faq#closures_and_goroutines + + if replay.Exec != nil { + if replay.Exec.Meta.InvalidSchema { + continue + } + } + + file := filepath.Join(replay.Path, replay.ConfigName) + rd, err := os.Open(file) + if err != nil { + t.Fatal(err) + } + + conf, err := config.ParseConfig(rd) + if err != nil { + t.Fatal(err) + } + + for j, pkg := range conf.SQL { + j, pkg := j, pkg + 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() + + var schema []string + for _, path := range pkg.Schema { + schema = append(schema, filepath.Join(filepath.Dir(file), path)) + } + + switch pkg.Engine { + case config.EnginePostgreSQL: + local.PostgreSQL(t, schema) + case config.EngineMySQL: + local.MySQL(t, schema) + } + }) + } + } +} diff --git a/internal/endtoend/endtoend_test.go b/internal/endtoend/endtoend_test.go index 5df39c44e9..da6d7a405a 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/local" ) +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,75 +89,156 @@ 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) { - t.Parallel() + // Ensure that this environment variable is always set to true when running + // end-to-end tests + os.Setenv("SQLC_DUMMY_VALUE", "true") + + // 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 - } - if info.Name() == "sqlc.json" || info.Name() == "sqlc.yaml" { - dirs = append(dirs, filepath.Dir(path)) - return filepath.SkipDir - } - return nil - }) - if err != nil { - t.Fatal(err) + + 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: local.PostgreSQLServer(), + }, + + { + Name: "mysql", + Engine: config.EngineMySQL, + URI: local.MySQLServer(), + }, + } + 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 { + if len(os.Getenv("POSTGRESQL_SERVER_URI")) == 0 { + return false + } + if len(os.Getenv("MYSQL_SERVER_URI")) == 0 { + return false + } + return true + }, + }, } - 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 + for name, testctx := range contexts { + name := name + testctx := testctx - path, _ := filepath.Abs(tc) - args := parseExec(t, path) - expected := expectedStderr(t, path) + if !testctx.Enabled() { + continue + } + + 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 - if args.Process != "" { - _, err := osexec.LookPath(args.Process) - if err != nil { - t.Skipf("executable not found: %s %s", args.Process, err) + 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) + } + }) + } } } @@ -184,60 +286,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) { @@ -247,7 +313,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 } @@ -262,7 +328,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/json_schema_test.go b/internal/endtoend/json_schema_test.go new file mode 100644 index 0000000000..64893e2379 --- /dev/null +++ b/internal/endtoend/json_schema_test.go @@ -0,0 +1,82 @@ +package main + +import ( + "encoding/json" + "io/fs" + "os" + "path/filepath" + "testing" + + "github.com/xeipuuv/gojsonschema" +) + +type conf struct { + Version string `json:"version"` +} + +func loadSchema(t *testing.T, path string) *gojsonschema.Schema { + t.Helper() + + schemaBytes, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + + loader := gojsonschema.NewStringLoader(string(schemaBytes)) + schema, err := gojsonschema.NewSchema(loader) + if err != nil { + t.Fatalf("invalid schema: %s", err) + } + return schema +} + +func TestJsonSchema(t *testing.T) { + t.Parallel() + + schemaOne := loadSchema(t, filepath.Join("..", "config", "v_one.json")) + schemaTwo := loadSchema(t, filepath.Join("..", "config", "v_two.json")) + + srcs := []string{ + filepath.Join("..", "..", "examples"), + filepath.Join("testdata"), + } + + for _, dir := range srcs { + err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + if filepath.Base(path) != "sqlc.json" { + return nil + } + t.Run(path, func(t *testing.T) { + t.Parallel() + contents, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + var c conf + if err := json.Unmarshal(contents, &c); err != nil { + t.Fatal(err) + } + l := gojsonschema.NewStringLoader(string(contents)) + switch c.Version { + case "1": + if _, err := schemaOne.Validate(l); err != nil { + t.Fatal(err) + } + case "2": + if _, err := schemaTwo.Validate(l); err != nil { + t.Fatal(err) + } + default: + t.Fatalf("unknown schema version: %s", c.Version) + } + }) + return nil + }) + if err != nil { + t.Error(err) + } + } +} diff --git a/internal/endtoend/testdata/alias/mysql/go/db.go b/internal/endtoend/testdata/alias/mysql/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/alias/mysql/go/models.go b/internal/endtoend/testdata/alias/mysql/go/models.go index abf1890cf1..fc79eb7922 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.20.0 +// sqlc v1.29.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 289d912c75..3492eca04b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 ef2dd40518..568a1b8c02 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 ef2dd40518..568a1b8c02 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 3bd20c2fd7..94a50d4b50 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/alias/sqlite/go/models.go b/internal/endtoend/testdata/alias/sqlite/go/models.go index 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 a19a8b58f3..a370f91daa 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 0adf1cb8f5..631370145e 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 0adf1cb8f5..631370145e 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/any/stdlib/go/models.go b/internal/endtoend/testdata/any/stdlib/go/models.go index 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 d9e09e91e8..b458d9043f 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 a75a2f755a..130700923f 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 a75a2f755a..130700923f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 306a065d22..7fb526935c 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 fdcf5ffac4..983f9feae1 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.20.0 +// sqlc v1.29.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 3dd6cbf8d1..544a7fb868 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 fdcf5ffac4..983f9feae1 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.20.0 +// sqlc v1.29.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 3dd6cbf8d1..544a7fb868 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 fdcf5ffac4..983f9feae1 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.20.0 +// sqlc v1.29.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 6b5a985eac..1d02ec58bc 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 54746ae3e0..c0071dad8b 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.20.0 +// sqlc v1.29.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 38d5e01abc..c2441308e1 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 54746ae3e0..c0071dad8b 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.20.0 +// sqlc v1.29.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 38d5e01abc..c2441308e1 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 54746ae3e0..c0071dad8b 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.20.0 +// sqlc v1.29.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 499b3777b4..91c14c174a 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.20.0 +// sqlc v1.29.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 5ce9eea6e0..1f4a41ec15 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.20.0 +// sqlc v1.29.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 4a94b23ac3..400a67a359 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.20.0 +// sqlc v1.29.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 db3ac428a6..a16a663b8d 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.20.0 +// sqlc v1.29.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 0093fe4372..d86ba36318 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.20.0 +// sqlc v1.29.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 f9b5f72f1f..06f3d60b81 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.20.0 +// sqlc v1.29.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 6038202791..e7a9ed88fd 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.20.0 +// sqlc v1.29.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 91c8db3616..c360caebaf 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.20.0 +// sqlc v1.29.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 0093fe4372..d86ba36318 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.20.0 +// sqlc v1.29.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 9f9d0acc65..7563e79ffb 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.20.0 +// sqlc v1.29.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 4a94b23ac3..400a67a359 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.20.0 +// sqlc v1.29.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 db3ac428a6..a16a663b8d 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.20.0 +// sqlc v1.29.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 a6bbd20c68..04f94d662d 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.20.0 +// sqlc v1.29.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 8e53deedc7..774d2dcc51 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.20.0 +// sqlc v1.29.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 6038202791..e7a9ed88fd 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.20.0 +// sqlc v1.29.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 91c8db3616..c360caebaf 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.20.0 +// sqlc v1.29.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 c669723473..dd8b954903 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.20.0 +// sqlc v1.29.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..190a712821 --- /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.29.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..e7a9ed88fd --- /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.29.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..53c974680f --- /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.29.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..d86ba36318 --- /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.29.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..3eeec80448 --- /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.29.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..e7a9ed88fd --- /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.29.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..1b99d4df60 --- /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.29.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..d86ba36318 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 44e4fd3a18..20b86cb24e 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.20.0 +// sqlc v1.29.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 a94105f2b5..64f6028ceb 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 cae89a49ff..21e9c16efb 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.20.0 +// sqlc v1.29.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 12aad86174..036766aad0 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..635cce3c5d --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/bit_string/pgx/v4/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go new file mode 100644 index 0000000000..583cd7dbe4 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type TestTable struct { + VBitNull pgtype.Varbit + VVarbitNull pgtype.Varbit + VBit pgtype.Varbit + VVarbit pgtype.Varbit +} 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 new file mode 100644 index 0000000000..03281c234b --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_bit_null, v_varbit_null, v_bit, v_varbit +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBitNull, + &i.VVarbitNull, + &i.VBit, + &i.VVarbit, + ); 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/bit_string/pgx/v4/query.sql b/internal/endtoend/testdata/bit_string/pgx/v4/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- 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/func_return/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json similarity index 100% rename from internal/endtoend/testdata/func_return/postgresql/pgx/v4/sqlc.json rename to internal/endtoend/testdata/bit_string/pgx/v4/sqlc.json diff --git a/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go new file mode 100644 index 0000000000..e83d6a948c --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/bit_string/pgx/v5/go/models.go b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go new file mode 100644 index 0000000000..851e114255 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/models.go @@ -0,0 +1,16 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type TestTable struct { + VBitNull pgtype.Bits + VVarbitNull pgtype.Bits + VBit pgtype.Bits + VVarbit pgtype.Bits +} 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 new file mode 100644 index 0000000000..03281c234b --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/go/query.sql.go @@ -0,0 +1,40 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_bit_null, v_varbit_null, v_bit, v_varbit +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBitNull, + &i.VVarbitNull, + &i.VBit, + &i.VVarbit, + ); 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/bit_string/pgx/v5/query.sql b/internal/endtoend/testdata/bit_string/pgx/v5/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/bit_string/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- 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/func_return/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json similarity index 100% rename from internal/endtoend/testdata/func_return/postgresql/pgx/v5/sqlc.json rename to internal/endtoend/testdata/bit_string/pgx/v5/sqlc.json 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..103c0bafad --- /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.29.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..df4b24c01e --- /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.29.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..2c0d683bcc --- /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.29.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..b46465478f --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/builtins/postgresql/go/models.go b/internal/endtoend/testdata/builtins/postgresql/go/models.go index e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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..ff788f4482 --- /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.29.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 366019ac06..3b4c7e95e7 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1a0f4a15fa..a35745d9a2 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.20.0 +// sqlc v1.29.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 82b0288cd6..a570034cc8 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.20.0 +// sqlc v1.29.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 3ce359786b..eab6669118 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 fe801ae987..4821a3642e 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.20.0 +// sqlc v1.29.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 599c0b8b98..57657746a4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 fe801ae987..4821a3642e 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.20.0 +// sqlc v1.29.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 83b0b0a8e7..2b676e7c18 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..2955bef41a --- /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.29.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..0a5ae3bf05 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a6439a153d..47bb6419a8 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.20.0 +// sqlc v1.29.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 f3f772df77..58663423c3 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 7c318aa694..c6130ca198 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 7c318aa694..c6130ca198 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 ab05aeb889..07cf71f87f 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 8a7408ae53..c748ca9777 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 8a7408ae53..c748ca9777 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 0022fcbcda..06473d70cd 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..b259c439a6 --- /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.29.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..0d8fd285d2 --- /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.29.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..e83d6a948c --- /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.29.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..9325161696 --- /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.29.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..ea96e95d65 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 a096f55f4a..52a219578a 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 3c94fb0698..444ea4ad0b 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.20.0 +// sqlc v1.29.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 a096f55f4a..52a219578a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 89b1cb4b3c..caaccc9c4a 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 a236633f38..3890dabb4f 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 3c94fb0698..444ea4ad0b 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.20.0 +// sqlc v1.29.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 32833e3a2f..4431e19009 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 493dec10e3..0e3f67559b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 68fa21ea84..9bca50416f 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.20.0 +// sqlc v1.29.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 2fca3263b3..6fa2fa3ff8 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..635cce3c5d --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/cid_oid_tid_xid/pgx/v4/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go new file mode 100644 index 0000000000..c3d64c66de --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type TestTable struct { + VCidNull pgtype.CID + VOidNull pgtype.OID + VTidNull pgtype.TID + VXidNull pgtype.XID + VCid pgtype.CID + VOid pgtype.OID + VTid pgtype.TID + VXid pgtype.XID +} 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 new file mode 100644 index 0000000000..c34d6ef804 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_cid_null, v_oid_null, v_tid_null, v_xid_null, v_cid, v_oid, v_tid, v_xid +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VCidNull, + &i.VOidNull, + &i.VTidNull, + &i.VXidNull, + &i.VCid, + &i.VOid, + &i.VTid, + &i.VXid, + ); 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/cid_oid_tid_xid/pgx/v4/query.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "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 new file mode 100644 index 0000000000..e83d6a948c --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/cid_oid_tid_xid/pgx/v5/go/models.go b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go new file mode 100644 index 0000000000..05f772b63a --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/models.go @@ -0,0 +1,20 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "github.com/jackc/pgx/v5/pgtype" +) + +type TestTable struct { + VCidNull pgtype.Uint32 + VOidNull pgtype.Uint32 + VTidNull pgtype.TID + VXidNull pgtype.Uint32 + VCid pgtype.Uint32 + VOid pgtype.Uint32 + VTid pgtype.TID + VXid pgtype.Uint32 +} 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 new file mode 100644 index 0000000000..c34d6ef804 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_cid_null, v_oid_null, v_tid_null, v_xid_null, v_cid, v_oid, v_tid, v_xid +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VCidNull, + &i.VOidNull, + &i.VTidNull, + &i.VXidNull, + &i.VCid, + &i.VOid, + &i.VTid, + &i.VXid, + ); 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/cid_oid_tid_xid/pgx/v5/query.sql b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/pgx/v5/query.sql @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/cid_oid_tid_xid/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/citext/pgx/go/db.go b/internal/endtoend/testdata/citext/pgx/go/db.go index f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/citext/pgx/go/models.go b/internal/endtoend/testdata/citext/pgx/go/models.go index 182812b8db..ec31ca0a4f 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.20.0 +// sqlc v1.29.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 38ede86116..a156ca9fe9 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.20.0 +// sqlc v1.29.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 2e358ab8d0..0c151ef5f6 100644 --- a/internal/endtoend/testdata/citext/pgx/query.sql +++ b/internal/endtoend/testdata/citext/pgx/query.sql @@ -1,9 +1,3 @@ -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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/citext/stdlib/go/models.go b/internal/endtoend/testdata/citext/stdlib/go/models.go index 182812b8db..ec31ca0a4f 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.20.0 +// sqlc v1.29.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 e52a70817a..51c2b5408a 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.20.0 +// sqlc v1.29.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 14543023c7..b6b08d2144 100644 --- a/internal/endtoend/testdata/citext/stdlib/query.sql +++ b/internal/endtoend/testdata/citext/stdlib/query.sql @@ -1,8 +1,3 @@ -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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/mysql/go/models.go b/internal/endtoend/testdata/coalesce/mysql/go/models.go index 182812b8db..ec31ca0a4f 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.20.0 +// sqlc v1.29.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 f885e83586..6e1c2af12d 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 48e277468d..0ae1f6357a 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.20.0 +// sqlc v1.29.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 aab63dd516..99c8e613a7 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 d091b1866d..ee40d12938 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.20.0 +// sqlc v1.29.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 d82b964aac..fcd89fa53b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 48e277468d..0ae1f6357a 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.20.0 +// sqlc v1.29.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 4b4633018d..c469363b27 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/coalesce/sqlite/go/models.go b/internal/endtoend/testdata/coalesce/sqlite/go/models.go index 182812b8db..ec31ca0a4f 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.20.0 +// sqlc v1.29.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 f885e83586..6e1c2af12d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 12e4ed36c4..456c99daf0 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.20.0 +// sqlc v1.29.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 43cfe50214..61ae82922f 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..fc0dae5f42 --- /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.29.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..15d047e104 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 b458b16b7c..ca329e6ec1 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.20.0 +// sqlc v1.29.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 2d79ff9b5e..95c0f426a9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 596b6b910f..fc0dae5f42 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.20.0 +// sqlc v1.29.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 5e1f9366e6..f6f770e5ae 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b458b16b7c..ca329e6ec1 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.20.0 +// sqlc v1.29.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 43cfe50214..61ae82922f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b458b16b7c..ca329e6ec1 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.20.0 +// sqlc v1.29.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 43cfe50214..61ae82922f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f5ad01be06..b0d0fd586b 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.20.0 +// sqlc v1.29.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 16f5b49e61..fa07a9c9ac 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..6e0fdc2476 --- /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.29.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..d4af90c356 --- /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.29.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 d060fbef2e..3f5041a35d 100644 --- a/internal/endtoend/testdata/codegen_json/gen/codegen.json +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -8,46 +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_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": { @@ -65396,6 +65363,7 @@ "insert_into_table": null } ], - "sqlc_version": "v1.20.0", - "plugin_options": "" + "sqlc_version": "v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 301231be3a..00bc1c86f8 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.20.0 +// sqlc v1.29.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 5bf15c1e63..70484dd859 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..0e8459d755 --- /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.29.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..d8f7c85274 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1799cf3af6..c157a76881 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/models.go +++ b/internal/endtoend/testdata/column_as/mysql/go/models.go @@ -1,11 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest - -import () - -type Foo struct { - Email string -} 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 da7bd6bbe9..0f522edd1e 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,29 +9,34 @@ import ( "context" ) -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y ` -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAs) - 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 +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRowContext(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRowContext(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err } diff --git a/internal/endtoend/testdata/column_as/mysql/query.sql b/internal/endtoend/testdata/column_as/mysql/query.sql index 4b055cc896..35014456bb 100644 --- a/internal/endtoend/testdata/column_as/mysql/query.sql +++ b/internal/endtoend/testdata/column_as/mysql/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (email text not null); +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; -/* name: ColumnAs :many */ -SELECT email AS id FROM foo; +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 1799cf3af6..c157a76881 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,11 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest - -import () - -type Foo struct { - Email string -} 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 ca2b6e2495..96874b715b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,26 +9,34 @@ import ( "context" ) -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y ` -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, columnAs) - 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 +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRow(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRow(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err } diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql index 339627fd50..35014456bb 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (email text not null); +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; --- name: ColumnAs :many -SELECT email AS id FROM foo; +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 1799cf3af6..c157a76881 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,11 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest - -import () - -type Foo struct { - Email string -} 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 ca2b6e2495..96874b715b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,26 +9,34 @@ import ( "context" ) -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y ` -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, columnAs) - 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 +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRow(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRow(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err } diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql index 339627fd50..35014456bb 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (email text not null); +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; --- name: ColumnAs :many -SELECT email AS id FROM foo; +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1799cf3af6..c157a76881 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/models.go @@ -1,11 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest - -import () - -type Foo struct { - Email string -} 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 da7bd6bbe9..0f522edd1e 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,29 +9,34 @@ import ( "context" ) -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y ` -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAs) - 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 +type WithAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRowContext(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int32 + Y int32 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRowContext(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err } diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql b/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql index 339627fd50..35014456bb 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (email text not null); +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; --- name: ColumnAs :many -SELECT email AS id FROM foo; +-- name: WithoutAs :one +SELECT 1 x, 2 y; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1799cf3af6..c157a76881 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/models.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/models.go @@ -1,11 +1,5 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest - -import () - -type Foo struct { - Email string -} 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 da7bd6bbe9..10cb4e4fb2 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,29 +9,34 @@ import ( "context" ) -const columnAs = `-- name: ColumnAs :many -SELECT email AS id FROM foo +const withAs = `-- name: WithAs :one +SELECT 1 AS x, 2 AS y ` -func (q *Queries) ColumnAs(ctx context.Context) ([]string, error) { - rows, err := q.db.QueryContext(ctx, columnAs) - 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 +type WithAsRow struct { + X int64 + Y int64 +} + +func (q *Queries) WithAs(ctx context.Context) (WithAsRow, error) { + row := q.db.QueryRowContext(ctx, withAs) + var i WithAsRow + err := row.Scan(&i.X, &i.Y) + return i, err +} + +const withoutAs = `-- name: WithoutAs :one +SELECT 1 x, 2 y +` + +type WithoutAsRow struct { + X int64 + Y int64 +} + +func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { + row := q.db.QueryRowContext(ctx, withoutAs) + var i WithoutAsRow + err := row.Scan(&i.X, &i.Y) + return i, err } diff --git a/internal/endtoend/testdata/column_as/sqlite/query.sql b/internal/endtoend/testdata/column_as/sqlite/query.sql index 4b055cc896..c7282d88ef 100644 --- a/internal/endtoend/testdata/column_as/sqlite/query.sql +++ b/internal/endtoend/testdata/column_as/sqlite/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (email text not null); +-- name: WithAs :one +SELECT 1 AS x, 2 AS y; -/* name: ColumnAs :many */ -SELECT email AS id FROM foo; +-- name: WithoutAs :one +SELECT 1 x, 2 y; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 76628ae454..a758ce3912 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 3c94fb0698..444ea4ad0b 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.20.0 +// sqlc v1.29.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 9b9d198cb7..058336cc6d 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.20.0 +// sqlc v1.29.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 f37c47afa7..397edca7ae 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 06050bb2cb..528b6b0eac 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.20.0 +// sqlc v1.29.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 68692e02d1..ba7419ccd2 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.20.0 +// sqlc v1.29.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 3c94fb0698..444ea4ad0b 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.20.0 +// sqlc v1.29.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 5037e67e03..76b6277525 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 da9ae60857..c00a1d1ed2 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.20.0 +// sqlc v1.29.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 e46688f4ff..f8c5342217 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 da9ae60857..c00a1d1ed2 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.20.0 +// sqlc v1.29.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 e46688f4ff..f8c5342217 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 da9ae60857..c00a1d1ed2 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.20.0 +// sqlc v1.29.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 f07622be9b..50187f6aaf 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 7bda7762a8..261ffbb3e6 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 9389afcafc..bda90e2254 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 3c94fb0698..444ea4ad0b 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.20.0 +// sqlc v1.29.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 1cfd1d823a..1c3b66489a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 0de534c0a0..a6687798dc 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 28a90130e1..2a73c4d633 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.20.0 +// sqlc v1.29.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 0de534c0a0..a6687798dc 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/mysql/go/models.go b/internal/endtoend/testdata/comparisons/mysql/go/models.go index abf1890cf1..fc79eb7922 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.20.0 +// sqlc v1.29.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 cd77cc1b42..918d0ac501 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -117,6 +117,60 @@ func (q *Queries) GreaterThanOrEqual(ctx context.Context) ([]bool, error) { return items, nil } +const isNotNull = `-- name: IsNotNull :many +SELECT id IS NOT NULL FROM bar +` + +func (q *Queries) IsNotNull(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, isNotNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + 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 isNull = `-- name: IsNull :many +SELECT id IS NULL FROM bar +` + +func (q *Queries) IsNull(ctx context.Context) ([]bool, error) { + rows, err := q.db.QueryContext(ctx, isNull) + if err != nil { + return nil, err + } + defer rows.Close() + var items []bool + for rows.Next() { + var column_1 bool + 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 lessThan = `-- name: LessThan :many SELECT count(*) < 0 FROM bar ` diff --git a/internal/endtoend/testdata/comparisons/mysql/query.sql b/internal/endtoend/testdata/comparisons/mysql/query.sql index 3c609f4660..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; @@ -24,8 +19,8 @@ SELECT count(*) <> 0 FROM bar; -- name: Equal :many SELECT count(*) = 0 FROM bar; +-- name: IsNull :many +SELECT id IS NULL FROM bar; - - - - +-- name: IsNotNull :many +SELECT id IS NOT NULL 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 2796b2bbe4..76ac7576f4 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 2796b2bbe4..76ac7576f4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 cd77cc1b42..7a29b82a7e 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/comparisons/sqlite/go/models.go b/internal/endtoend/testdata/comparisons/sqlite/go/models.go index 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 cd77cc1b42..7a29b82a7e 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 fe49feb2be..070d007c97 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.20.0 +// sqlc v1.29.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 38c4c8f519..4ec76b2d99 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 fe49feb2be..070d007c97 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.20.0 +// sqlc v1.29.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 38c4c8f519..4ec76b2d99 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 fe49feb2be..070d007c97 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.20.0 +// sqlc v1.29.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 df2627a8f4..726f657adf 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 412b2413c0..1615dc7113 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.20.0 +// sqlc v1.29.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 32378e5a5f..a63148bf27 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.20.0 +// sqlc v1.29.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 38f5a3cbed..a9740e4f57 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/copyfrom/mysql/go/models.go b/internal/endtoend/testdata/copyfrom/mysql/go/models.go index 978d074001..4a304a0e34 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.20.0 +// sqlc v1.29.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 d52c2c33e8..3e653d2601 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.20.0 +// sqlc v1.29.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 a953ca2e96..ac86e21374 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.20.0 +// sqlc v1.29.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 8ced035256..74a5aab7c4 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.20.0 +// sqlc v1.29.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 db3ac428a6..a16a663b8d 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.20.0 +// sqlc v1.29.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 c431241eee..d598540ae5 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.20.0 +// sqlc v1.29.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 d5607a9615..ee9488277b 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.20.0 +// sqlc v1.29.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 dbefa89a1a..547f6f9aee 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.20.0 +// sqlc v1.29.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 a9e33d96b1..867387a8ec 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.20.0 +// sqlc v1.29.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 91c8db3616..c360caebaf 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.20.0 +// sqlc v1.29.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 f90e5322c8..67a4174d3c 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.20.0 +// sqlc v1.29.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 3adf06fc94..f0e60ef0d0 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.20.0 +// sqlc v1.29.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 623ac87b2b..bb14e74539 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.20.0 +// sqlc v1.29.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 8ced035256..74a5aab7c4 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.20.0 +// sqlc v1.29.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 db3ac428a6..a16a663b8d 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.20.0 +// sqlc v1.29.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 b246fbd37d..f040340ce5 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.20.0 +// sqlc v1.29.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 623ac87b2b..bb14e74539 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.20.0 +// sqlc v1.29.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 a9e33d96b1..867387a8ec 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.20.0 +// sqlc v1.29.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 91c8db3616..c360caebaf 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.20.0 +// sqlc v1.29.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 d1151eb25c..acf744a76d 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.20.0 +// sqlc v1.29.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..158eb49726 --- /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.29.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..a92cd6e8eb --- /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.29.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..825fc25a19 --- /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.29.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..711c7fbdd0 --- /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.29.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..21fbafcccb --- /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.29.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..867387a8ec --- /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.29.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..1c78a15842 --- /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.29.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..656d5e90db --- /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.29.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 0a0272e33d..ecaf5d959e 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.20.0 +// sqlc v1.29.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 8ced035256..74a5aab7c4 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.20.0 +// sqlc v1.29.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 50381dedb6..510ddefc23 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.20.0 +// sqlc v1.29.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 3bef84933e..cd193590d1 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.20.0 +// sqlc v1.29.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 0093fe4372..d86ba36318 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.20.0 +// sqlc v1.29.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 0a0272e33d..ecaf5d959e 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.20.0 +// sqlc v1.29.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 a9e33d96b1..867387a8ec 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.20.0 +// sqlc v1.29.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 50381dedb6..510ddefc23 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.20.0 +// sqlc v1.29.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 3bef84933e..cd193590d1 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.20.0 +// sqlc v1.29.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 0093fe4372..d86ba36318 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.20.0 +// sqlc v1.29.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..e4cd08f962 --- /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.29.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..a92cd6e8eb --- /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.29.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..69dbf9ba40 --- /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.29.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..a71be53c0b --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 abf1890cf1..fc79eb7922 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.20.0 +// sqlc v1.29.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 62d3bf69da..03caf1aa89 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 6f8f936bad..0f87629324 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 6f8f936bad..0f87629324 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 62d3bf69da..03caf1aa89 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 62d3bf69da..03caf1aa89 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 078395ac40..0a7e41d539 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.20.0 +// sqlc v1.29.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 610d227d89..fce6b28372 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7ebb9b217d..7df3c725b1 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.20.0 +// sqlc v1.29.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 499e198dae..2f6c7ece42 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8ee177f29f..eef739f30f 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.20.0 +// sqlc v1.29.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 fe525379b4..7a06fb8aa6 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8ee177f29f..eef739f30f 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.20.0 +// sqlc v1.29.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 fe525379b4..7a06fb8aa6 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4bd440e86e..568db73ea9 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.20.0 +// sqlc v1.29.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 d1f71f14f4..476b34c387 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4bd440e86e..568db73ea9 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.20.0 +// sqlc v1.29.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 8c5509ec4b..a9c3eaba06 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c4415bdb6f..546a62b209 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.20.0 +// sqlc v1.29.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 6f72cd1f5c..b338c4a231 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 4d232a9cdb..387a9dc53e 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 253ba844b3..dc38294ce4 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 253ba844b3..dc38294ce4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 4d232a9cdb..387a9dc53e 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 d999ac7526..a527e060bd 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 c383fa2383..2860f595fe 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 c383fa2383..2860f595fe 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 15e94dcf07..61376081d6 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.20.0 +// sqlc v1.29.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 e0c4618f12..e15cee8070 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1a9a724013..61e553691d 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.20.0 +// sqlc v1.29.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 2755b6a78d..53517e7ee3 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 1a9a724013..61e553691d 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.20.0 +// sqlc v1.29.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 e64101bf3b..6f91295ba4 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 1a9a724013..61e553691d 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.20.0 +// sqlc v1.29.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 e64101bf3b..6f91295ba4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1a9a724013..61e553691d 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.20.0 +// sqlc v1.29.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 19ce2ba886..41a95c71b2 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..a3bfe68382 --- /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.29.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..e83d6a948c --- /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.29.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..40722f5543 --- /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.29.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..b2e3f02cd5 --- /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.29.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..e83d6a948c --- /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.29.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..40722f5543 --- /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.29.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..91d0dcfb2f --- /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.29.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..e83d6a948c --- /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.29.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..53c974680f --- /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.29.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..3286ebd6c7 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7099a7e5fd..f8b99f998a 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.20.0 +// sqlc v1.29.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 8827e145f6..b3426406d1 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 7099a7e5fd..f8b99f998a 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.20.0 +// sqlc v1.29.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 ff3a52e6fa..3ac4755409 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 604e3fd0ca..df1df27819 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.20.0 +// sqlc v1.29.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 950167e64e..c1f3bcc971 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7099a7e5fd..f8b99f998a 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.20.0 +// sqlc v1.29.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 80702152cd..faa6eb8131 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..7f00553ea9 --- /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.29.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..d0564e60bf --- /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.29.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..e83d6a948c --- /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.29.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..8c0c59ac1f --- /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.29.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..c244a0c3f4 --- /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.29.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..e83d6a948c --- /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.29.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..be64c0c729 --- /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.29.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..a238b10bc5 --- /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.29.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..e83d6a948c --- /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.29.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..fb4e963c89 --- /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.29.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..8e381578a8 --- /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.29.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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..31d148b699 --- /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.29.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..e83d6a948c --- /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.29.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..0c11af3b9e --- /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.29.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..0312bc70c7 --- /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.29.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..e83d6a948c --- /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.29.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..5eb265f649 --- /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.29.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..670093b4f2 --- /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.29.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..e83d6a948c --- /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.29.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..4678711c2b --- /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.29.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..657cd8e3c3 --- /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.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 c1016e9836..7fff3f7385 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.20.0 +// sqlc v1.29.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 0621aac7a0..9ea1731e33 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 2c4be50030..3349ee8857 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.20.0 +// sqlc v1.29.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 42634c5b27..21bd811aee 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 0a2928df38..2452d64b8b 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.20.0 +// sqlc v1.29.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 42634c5b27..21bd811aee 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4be50030..3349ee8857 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.20.0 +// sqlc v1.29.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 3f47d503e8..04507a525b 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 663e230349..224640ab87 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.20.0 +// sqlc v1.29.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 74a67bce80..c7ddbd46b9 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.20.0 +// sqlc v1.29.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 69db5842a6..dfc3d5029a 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.20.0 +// sqlc v1.29.0 package datatype diff --git a/internal/endtoend/testdata/datatype/mysql/go/models.go b/internal/endtoend/testdata/datatype/mysql/go/models.go index e8dd7a14a3..e600252c18 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.20.0 +// sqlc v1.29.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..7420549bd6 --- /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.29.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 552cf4553d..998accfb8f 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.20.0 +// sqlc v1.29.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 5017328357..b7295e1492 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.20.0 +// sqlc v1.29.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..99edb91f8b --- /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.29.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 448766bdaa..814523221a 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.20.0 +// sqlc v1.29.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 3a5b2b4617..059adc1c6b 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.20.0 +// sqlc v1.29.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..99edb91f8b --- /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.29.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 69db5842a6..dfc3d5029a 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.20.0 +// sqlc v1.29.0 package datatype diff --git a/internal/endtoend/testdata/datatype/sqlite/go/models.go b/internal/endtoend/testdata/datatype/sqlite/go/models.go index 35393d68a4..135196f1bf 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.20.0 +// sqlc v1.29.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..c9bc454608 --- /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.29.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 69db5842a6..dfc3d5029a 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.20.0 +// sqlc v1.29.0 package datatype diff --git a/internal/endtoend/testdata/datatype/stdlib/go/models.go b/internal/endtoend/testdata/datatype/stdlib/go/models.go index 3de21ca054..dcc12da4e7 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.20.0 +// sqlc v1.29.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..7420549bd6 --- /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.29.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..e83d6a948c --- /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.29.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..85247f8d81 --- /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.29.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..41de77d4a2 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7184db532a..17749bd1b3 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 7184db532a..f50f1307b4 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.20.0 +// sqlc v1.29.0 package querytest @@ -9,7 +9,8 @@ import ( ) type Foo struct { - Bar string - Baz sql.NullInt32 - Bio sql.NullInt32 + Bar string + Baz sql.NullInt32 + Bio sql.NullInt32 + Foobar []int32 } 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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql index 01c3f60d0f..a70d902d4e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v4/schema.sql @@ -1,3 +1,4 @@ CREATE TABLE foo (bar text NOT NULL); ALTER TABLE foo ADD COLUMN baz int; ALTER TABLE foo ADD bio int; +ALTER TABLE foo ADD COLUMN foobar int[]; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 dee8aa7628..35a9bfa10b 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.20.0 +// sqlc v1.29.0 package querytest @@ -9,7 +9,8 @@ import ( ) type Foo struct { - Bar string - Baz pgtype.Int4 - Bio pgtype.Int4 + Bar string + Baz pgtype.Int4 + Bio pgtype.Int4 + Foobar []int32 } 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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql index 01c3f60d0f..a70d902d4e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/pgx/v5/schema.sql @@ -1,3 +1,4 @@ CREATE TABLE foo (bar text NOT NULL); ALTER TABLE foo ADD COLUMN baz int; ALTER TABLE foo ADD bio int; +ALTER TABLE foo ADD COLUMN foobar int[]; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7184db532a..f50f1307b4 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.20.0 +// sqlc v1.29.0 package querytest @@ -9,7 +9,8 @@ import ( ) type Foo struct { - Bar string - Baz sql.NullInt32 - Bio sql.NullInt32 + Bar string + Baz sql.NullInt32 + Bio sql.NullInt32 + Foobar []int32 } 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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql index 01c3f60d0f..a70d902d4e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_add_column/postgresql/stdlib/schema.sql @@ -1,3 +1,4 @@ CREATE TABLE foo (bar text NOT NULL); ALTER TABLE foo ADD COLUMN baz int; ALTER TABLE foo ADD bio int; +ALTER TABLE foo ADD COLUMN foobar int[]; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 47b08bfb8f..5343489f2e 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.20.0 +// sqlc v1.29.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 07470e1bfe..91d985c366 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 42e344f5b1..45cc480747 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 42e344f5b1..45cc480747 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 42e344f5b1..45cc480747 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 59801b5083..3be5c5781e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 a20c6ce77b..5c2ed7e9dc 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql index 75a7a7bfbc..26fa6c7c9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a20c6ce77b..5c2ed7e9dc 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql index 75a7a7bfbc..26fa6c7c9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a20c6ce77b..5c2ed7e9dc 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql index 75a7a7bfbc..26fa6c7c9c 100644 --- a/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_alter_type/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar TEXT); -ALTER TABLE foo ALTER bar TYPE TEXT ARRAY; +ALTER TABLE foo ALTER bar TYPE TEXT ARRAY USING bar::text[]; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 6480238e62..98263fc24e 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 6480238e62..98263fc24e 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6480238e62..98263fc24e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 9f9b5bcf17..c55e67c9b2 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 9f9b5bcf17..c55e67c9b2 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 ebbd61ea02..4f6351ec45 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 9f9b5bcf17..c55e67c9b2 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 dbfa5f543a..fa3527440f 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 db58c291a9..06a522cb68 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 93c288dc92..f4413eb12e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 93c288dc92..f4413eb12e 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 93c288dc92..f4413eb12e 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 93c288dc92..f4413eb12e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 18a67110d4..8da37d326e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 45b59e4a89..f5747f5ec2 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql index 9477f00e68..1dbb844fa5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file +ALTER TABLE venues DROP CONSTRAINT venues_pkey; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 45b59e4a89..f5747f5ec2 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql index 9477f00e68..1dbb844fa5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file +ALTER TABLE venues DROP CONSTRAINT venues_pkey; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 45b59e4a89..f5747f5ec2 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql index 9477f00e68..1dbb844fa5 100644 --- a/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_drop_constraint/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE venues (id SERIAL PRIMARY KEY); -ALTER TABLE venues DROP CONSTRAINT venues_id_pkey; \ No newline at end of file +ALTER TABLE venues DROP CONSTRAINT venues_pkey; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 217da30204..8b5b1f8cb0 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,13 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest import ( "database/sql" + "time" ) -type Temp struct { - A sql.NullString +type Measurement struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 } 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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql index ead14d04ee..0fb8fb143e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v4/schema.sql @@ -1,4 +1,17 @@ -CREATE TABLE temp(a TEXT); +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); -CREATE INDEX temp_idx ON temp(a); -ALTER INDEX temp_idx ATTACH PARTITION temp_partition_idx; +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 dc62a3f7f4..ac1374a391 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,16 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) -type Temp struct { - A pgtype.Text +type Measurement struct { + CityID int32 + Logdate pgtype.Date + Peaktemp pgtype.Int4 + Unitsales pgtype.Int4 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate pgtype.Date + Peaktemp pgtype.Int4 + Unitsales pgtype.Int4 } 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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql index ead14d04ee..0fb8fb143e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/pgx/v5/schema.sql @@ -1,4 +1,17 @@ -CREATE TABLE temp(a TEXT); +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); -CREATE INDEX temp_idx ON temp(a); -ALTER INDEX temp_idx ATTACH PARTITION temp_partition_idx; +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); + +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 217da30204..8b5b1f8cb0 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,13 +1,24 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package querytest import ( "database/sql" + "time" ) -type Temp struct { - A sql.NullString +type Measurement struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 +} + +type MeasurementY2006m02 struct { + CityID int32 + Logdate time.Time + Peaktemp sql.NullInt32 + Unitsales sql.NullInt32 } 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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql index b74a806845..0fb8fb143e 100644 --- a/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_index/postgresql/stdlib/schema.sql @@ -1,5 +1,17 @@ -CREATE TABLE temp(a TEXT); +CREATE TABLE measurement ( + city_id int not null, + logdate date not null, + peaktemp int, + unitsales int +) PARTITION BY RANGE (logdate); -CREATE INDEX temp_idx ON temp(a); -ALTER INDEX temp_idx ATTACH PARTITION temp_partition_idx; +CREATE TABLE measurement_y2006m02 PARTITION OF measurement + FOR VALUES FROM ('2006-02-01') TO ('2006-03-01'); +CREATE INDEX measurement_usls_idx ON ONLY measurement (unitsales); + +CREATE INDEX measurement_usls_200602_idx + ON measurement_y2006m02 (unitsales); + +ALTER INDEX measurement_usls_idx + ATTACH PARTITION measurement_usls_200602_idx; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8649f59438..aa9b290c32 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 993def56f5..5c1153c787 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 2af1c3d26b..d3f9ebe669 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 993def56f5..5c1153c787 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 993def56f5..5c1153c787 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.20.0 +// sqlc v1.29.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 39905f1ce2..6d21d214d4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 dbfa5f543a..fa3527440f 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 99fdec6ddc..b31ad89375 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b066412dee..0cf9b819bd 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.20.0 +// sqlc v1.29.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 4f7ef5933e..70a74c3c78 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 995bfe2e28..9965194af2 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 0ba38a4f44..60f0040f7a 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql index 1ae8a69bf6..5ef5dc5489 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a0924e484b..382226b809 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql index 1ae8a69bf6..5ef5dc5489 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 0ba38a4f44..60f0040f7a 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql index 1ae8a69bf6..5ef5dc5489 100644 --- a/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_alter_table_set_data_type/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE TABLE foo (bar text); -ALTER TABLE foo ALTER bar SET DATA TYPE bool; \ No newline at end of file +ALTER TABLE foo ALTER bar SET DATA TYPE bool USING bar::boolean; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3f74920829..2e4ab15ca4 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 3f74920829..2e4ab15ca4 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 3f74920829..2e4ab15ca4 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3f74920829..2e4ab15ca4 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 c52ca59b33..4ce3e35c13 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.20.0 +// sqlc v1.29.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 3e35ac469b..5590c90afb 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 98e9b46876..898d5cb747 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.20.0 +// sqlc v1.29.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 a9cc2e84a9..325e20a336 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c52ca59b33..4ce3e35c13 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.20.0 +// sqlc v1.29.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 a103570c61..b4e1f945ef 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 5d0cd92dfb..7db2704ec6 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 5d0cd92dfb..7db2704ec6 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 5d0cd92dfb..7db2704ec6 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 42e9c7e198..b8ed7d4bab 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.20.0 +// sqlc v1.29.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 be7b627298..86c789bd05 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 42e9c7e198..b8ed7d4bab 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.20.0 +// sqlc v1.29.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 be7b627298..86c789bd05 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 42e9c7e198..b8ed7d4bab 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.20.0 +// sqlc v1.29.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 19e05c509d..a998b8b5cc 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 42e9c7e198..b8ed7d4bab 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.20.0 +// sqlc v1.29.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 be7b627298..86c789bd05 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 42e9c7e198..b8ed7d4bab 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.20.0 +// sqlc v1.29.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 be7b627298..86c789bd05 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 42e9c7e198..b8ed7d4bab 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.20.0 +// sqlc v1.29.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 19e05c509d..a998b8b5cc 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e4e6e24ddf..169be5ef9c 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e4e6e24ddf..169be5ef9c 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e4e6e24ddf..169be5ef9c 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 8783684b97..afa3bd2fcb 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.20.0 +// sqlc v1.29.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 c6989342a0..616439eef2 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 8783684b97..afa3bd2fcb 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.20.0 +// sqlc v1.29.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 c6989342a0..616439eef2 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8783684b97..afa3bd2fcb 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.20.0 +// sqlc v1.29.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 6bde1e9064..1b954fd37d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 05594029ea..dc0c1abc3c 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 fe2fcb6be0..7a9477825b 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 d9f09a18a1..eefe7f9f20 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 fe2fcb6be0..7a9477825b 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 90d7a772bc..9b6f6f1956 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.20.0 +// sqlc v1.29.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 1f0021f31a..6b194c12cd 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 c1090e6913..22a3e89f5f 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.20.0 +// sqlc v1.29.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 ead1a64eaf..43332b4941 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 c1090e6913..22a3e89f5f 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.20.0 +// sqlc v1.29.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 ead1a64eaf..43332b4941 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c1090e6913..22a3e89f5f 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.20.0 +// sqlc v1.29.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 acbfdeac68..6a52cff620 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql index a318fb91f2..4b98ce9597 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v4/schema.sql @@ -1 +1 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql index a318fb91f2..4b98ce9597 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/pgx/v5/schema.sql @@ -1 +1 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql index a318fb91f2..4b98ce9597 100644 --- a/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_return/postgresql/stdlib/schema.sql @@ -1 +1 @@ -CREATE FUNCTION foo(bar TEXT, baz TEXT="baz") RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar TEXT, baz TEXT='baz') RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql index b3a3f3b158..876d0f8e80 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v4/schema.sql @@ -1,2 +1,2 @@ CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql index b3a3f3b158..876d0f8e80 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/pgx/v5/schema.sql @@ -1,2 +1,2 @@ CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql index b3a3f3b158..876d0f8e80 100644 --- a/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_create_function_types/postgresql/stdlib/schema.sql @@ -1,2 +1,2 @@ CREATE FUNCTION foo(bar TEXT) RETURNS bool AS $$ SELECT true $$ LANGUAGE sql; -CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT "baz" $$ LANGUAGE sql; \ No newline at end of file +CREATE FUNCTION foo(bar INTEGER) RETURNS TEXT AS $$ SELECT 'baz' $$ LANGUAGE sql; diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_create_procedure/mysql/go/models.go b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go new file mode 100644 index 0000000000..9cb2016e9a --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "database/sql" +) + +type Tbl struct { + Value sql.NullInt32 +} 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 new file mode 100644 index 0000000000..592a81c529 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/go/query.sql.go @@ -0,0 +1,47 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const callInsertData = `-- name: CallInsertData :exec +CALL insert_data(?, ?) +` + +type CallInsertDataParams struct { + A int32 + B int32 +} + +func (q *Queries) CallInsertData(ctx context.Context, arg CallInsertDataParams) error { + _, err := q.db.ExecContext(ctx, callInsertData, arg.A, arg.B) + return err +} + +const callInsertDataNoArgs = `-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2) +` + +func (q *Queries) CallInsertDataNoArgs(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, callInsertDataNoArgs) + return err +} + +const callInsertDataSqlcArgs = `-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(?, ?) +` + +type CallInsertDataSqlcArgsParams struct { + Foo int32 + Bar int32 +} + +func (q *Queries) CallInsertDataSqlcArgs(ctx context.Context, arg CallInsertDataSqlcArgsParams) error { + _, err := q.db.ExecContext(ctx, callInsertDataSqlcArgs, arg.Foo, arg.Bar) + return err +} diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/query.sql b/internal/endtoend/testdata/ddl_create_procedure/mysql/query.sql new file mode 100644 index 0000000000..ff9bbadf2c --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/query.sql @@ -0,0 +1,8 @@ +-- name: CallInsertData :exec +CALL insert_data(?, ?); + +-- name: CallInsertDataNoArgs :exec +CALL insert_data(1, 2); + +-- name: CallInsertDataSqlcArgs :exec +CALL insert_data(sqlc.arg('foo'), sqlc.arg('bar')); diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/schema.sql b/internal/endtoend/testdata/ddl_create_procedure/mysql/schema.sql new file mode 100644 index 0000000000..e3f2d0af34 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE tbl ( + value int +); + +CREATE PROCEDURE insert_data(a int, b int) +BEGIN + INSERT INTO tbl VALUES (a); + INSERT INTO tbl VALUES (b); +END; \ No newline at end of file diff --git a/internal/endtoend/testdata/ddl_create_procedure/mysql/sqlc.json b/internal/endtoend/testdata/ddl_create_procedure/mysql/sqlc.json new file mode 100644 index 0000000000..e41c39e8b3 --- /dev/null +++ b/internal/endtoend/testdata/ddl_create_procedure/mysql/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "mysql", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 79f7ff39d7..9cb2016e9a 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.20.0 +// sqlc v1.29.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 cba1d583f6..a36d2a2272 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 aeb120c169..a019c9ea5b 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.20.0 +// sqlc v1.29.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 cba1d583f6..a36d2a2272 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 79f7ff39d7..9cb2016e9a 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.20.0 +// sqlc v1.29.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 93a7f8d965..c33943f9f9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 5d649373ee..532e8364ac 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 5d649373ee..532e8364ac 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 d67f074b17..f5ab8b72d7 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 5d649373ee..532e8364ac 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 5d649373ee..532e8364ac 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 22783b645e..e4c52c7871 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 4c7f0594ee..6f5e1d2f5a 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 22783b645e..e4c52c7871 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 ca6719a0f4..6c580ffd7a 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.20.0 +// sqlc v1.29.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 795e07fb95..215ee8c4b2 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e66592a58e..43249fd461 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.20.0 +// sqlc v1.29.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 795e07fb95..215ee8c4b2 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ca6719a0f4..6c580ffd7a 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.20.0 +// sqlc v1.29.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 414d920acb..f0df3d6157 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..84286acfdb --- /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.29.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..f8fea429b8 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 86d255f839..a5847be49a 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql index 29bf454622..928b1302bf 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v4/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE foo ( - id uuid PRIMARY KEY, + id uuid NOT NULL, other_id uuid NOT NULL ) PARTITION BY HASH (other_id); 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a0b91568ad..61d119b3fc 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql index 29bf454622..928b1302bf 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/pgx/v5/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE foo ( - id uuid PRIMARY KEY, + id uuid NOT NULL, other_id uuid NOT NULL ) PARTITION BY HASH (other_id); 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 86d255f839..a5847be49a 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql index 29bf454622..928b1302bf 100644 --- a/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_create_table_partition/postgresql/stdlib/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE foo ( - id uuid PRIMARY KEY, + id uuid NOT NULL, other_id uuid NOT NULL ) PARTITION BY HASH (other_id); 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d03fb7f10b..0208144f1e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d03fb7f10b..0208144f1e 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a60c46a3b0..7fbb04dae7 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d03fb7f10b..0208144f1e 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 5d649373ee..532e8364ac 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1d80feca97..52d4f06f74 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 3ef12f1b72..0358ffbfd0 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 28d13ea099..64193da248 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3ef12f1b72..0358ffbfd0 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b586c71021..c22041ba29 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql index 8553bb9e05..0b9d918da0 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v4/schema.sql @@ -1,3 +1,3 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; +DROP SCHEMA foo CASCADE; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql index 8553bb9e05..0b9d918da0 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/pgx/v5/schema.sql @@ -1,3 +1,3 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; +DROP SCHEMA foo CASCADE; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql index 8553bb9e05..0b9d918da0 100644 --- a/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_drop_schema/postgresql/stdlib/schema.sql @@ -1,3 +1,3 @@ CREATE SCHEMA foo; CREATE TABLE foo.bar (baz text); -DROP SCHEMA foo; +DROP SCHEMA foo CASCADE; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 cca1a2867d..7de432316d 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 84ef412b83..5e8c1ae352 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.20.0 +// sqlc v1.29.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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 cca1a2867d..7de432316d 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.20.0 +// sqlc v1.29.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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 67b70f58b5..a6b33bbd88 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,14 @@ import ( "database/sql" ) +type NewTable struct { + Val sql.NullInt32 +} + +type OldTable struct { + Val sql.NullInt32 +} + type PgTempMigrate struct { Val sql.NullInt32 } 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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql index 23a15e7842..c02d6df65e 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v4/schema.sql @@ -1,3 +1,5 @@ +CREATE TABLE old_table (val SERIAL); +CREATE TABLE new_table (val SERIAL); CREATE TABLE pg_temp.migrate (val SERIAL); -INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file +INSERT INTO pg_temp.migrate (val) SELECT val FROM old_table; +INSERT INTO new_table (val) SELECT val FROM pg_temp.migrate; 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 ad17aded29..892325d145 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,14 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type NewTable struct { + Val pgtype.Int4 +} + +type OldTable struct { + Val pgtype.Int4 +} + type PgTempMigrate struct { Val pgtype.Int4 } 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 27accfa36a..cdf14677d9 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql index 23a15e7842..c02d6df65e 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/pgx/v5/schema.sql @@ -1,3 +1,5 @@ +CREATE TABLE old_table (val SERIAL); +CREATE TABLE new_table (val SERIAL); CREATE TABLE pg_temp.migrate (val SERIAL); -INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file +INSERT INTO pg_temp.migrate (val) SELECT val FROM old_table; +INSERT INTO new_table (val) SELECT val FROM pg_temp.migrate; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 67b70f58b5..a6b33bbd88 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,14 @@ import ( "database/sql" ) +type NewTable struct { + Val sql.NullInt32 +} + +type OldTable struct { + Val sql.NullInt32 +} + type PgTempMigrate struct { Val sql.NullInt32 } 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 5b486ae252..079840519b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql index 23a15e7842..c02d6df65e 100644 --- a/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/ddl_pg_temp/postgresql/stdlib/schema.sql @@ -1,3 +1,5 @@ +CREATE TABLE old_table (val SERIAL); +CREATE TABLE new_table (val SERIAL); CREATE TABLE pg_temp.migrate (val SERIAL); -INSERT INTO pg_temp.migrate (val) SELECT val FROM old; -INSERT INTO new (val) SELECT val FROM pg_temp.migrate; \ No newline at end of file +INSERT INTO pg_temp.migrate (val) SELECT val FROM old_table; +INSERT INTO new_table (val) SELECT val FROM pg_temp.migrate; 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..635cce3c5d --- /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.29.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..e644702127 --- /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.29.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..14fb04e7b6 --- /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.29.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..e83d6a948c --- /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.29.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..9692a94f58 --- /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.29.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..14fb04e7b6 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 3ba9385ac2..e6e7dd42fa 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 3987fb5dd8..e074a89177 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 3987fb5dd8..e074a89177 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 a914cc86d7..d0d5339d75 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 3ba9385ac2..e6e7dd42fa 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d0c6e1f8c8..7609fc8f4c 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.20.0 +// sqlc v1.29.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 cce122ebfe..68b1206923 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 5bd0b2eaff..64fda3c52f 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.20.0 +// sqlc v1.29.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 5f2dc7e42d..b333a344e1 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.20.0 +// sqlc v1.29.0 // source: query.sql package db diff --git a/internal/endtoend/testdata/delete_join/mysql/query.sql b/internal/endtoend/testdata/delete_join/mysql/query.sql index 863a6769bd..d802ae12f1 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.* 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..e83d6a948c --- /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.29.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..95fdefbfb8 --- /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.29.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..1ab8a44baa --- /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.29.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 59d4f8061f..e2b0a86b13 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.20.0 +// sqlc v1.29.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 d667ed8686..fc0a058af4 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.20.0 +// sqlc v1.29.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 7da92992db..2111941fc0 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.20.0 +// sqlc v1.29.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 59d4f8061f..e2b0a86b13 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.20.0 +// sqlc v1.29.0 package authors diff --git a/internal/endtoend/testdata/diff_output/go/models.go b/internal/endtoend/testdata/diff_output/go/models.go index f8dd35243a..c665426db7 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.20.0 +// sqlc v1.29.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 209f1a43f7..18fbd87b65 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..0e4c3f4a0b --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/do/postgresql/pgx/db/models.go b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go new file mode 100644 index 0000000000..f111047f1c --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/do/postgresql/pgx/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go new file mode 100644 index 0000000000..794b2b4304 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package db + +import ( + "context" +) + +const doStuff = `-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$ +` + +func (q *Queries) DoStuff(ctx context.Context) error { + _, err := q.db.Exec(ctx, doStuff) + return err +} diff --git a/internal/endtoend/testdata/do/postgresql/pgx/query.sql b/internal/endtoend/testdata/do/postgresql/pgx/query.sql new file mode 100644 index 0000000000..26a790d341 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/query.sql @@ -0,0 +1,7 @@ +-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$; diff --git a/internal/endtoend/testdata/do/postgresql/pgx/schema.sql b/internal/endtoend/testdata/do/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/do/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/do/postgresql/pgx/sqlc.json b/internal/endtoend/testdata/do/postgresql/pgx/sqlc.json new file mode 100644 index 0000000000..b74a2efca0 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pgx/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "sql_package": "pgx/v5" + } + ] +} diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/db.go b/internal/endtoend/testdata/do/postgresql/pq/db/db.go new file mode 100644 index 0000000000..0c56c2b4e8 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/do/postgresql/pq/db/models.go b/internal/endtoend/testdata/do/postgresql/pq/db/models.go new file mode 100644 index 0000000000..601f8ed004 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/db/models.go @@ -0,0 +1,15 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package db + +import ( + "database/sql" +) + +type Author struct { + ID int64 + Name string + Bio sql.NullString +} diff --git a/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go new file mode 100644 index 0000000000..b8eae039f7 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/db/query.sql.go @@ -0,0 +1,24 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package db + +import ( + "context" +) + +const doStuff = `-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$ +` + +func (q *Queries) DoStuff(ctx context.Context) error { + _, err := q.db.ExecContext(ctx, doStuff) + return err +} diff --git a/internal/endtoend/testdata/do/postgresql/pq/query.sql b/internal/endtoend/testdata/do/postgresql/pq/query.sql new file mode 100644 index 0000000000..26a790d341 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/query.sql @@ -0,0 +1,7 @@ +-- name: DoStuff :exec +DO $$ + BEGIN + ALTER TABLE authors + ADD COLUMN marked_for_processing bool; + END +$$; diff --git a/internal/endtoend/testdata/do/postgresql/pq/schema.sql b/internal/endtoend/testdata/do/postgresql/pq/schema.sql new file mode 100644 index 0000000000..69b607d902 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/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/do/postgresql/pq/sqlc.json b/internal/endtoend/testdata/do/postgresql/pq/sqlc.json new file mode 100644 index 0000000000..2a46100899 --- /dev/null +++ b/internal/endtoend/testdata/do/postgresql/pq/sqlc.json @@ -0,0 +1,11 @@ +{ + "version": "1", + "packages": [ + { + "path": "db", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7a5981c738..af96ab9c8b 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..eb98a2bb58 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 7a5981c738..af96ab9c8b 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.20.0 +// sqlc v1.29.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 3fba9882e7..70b6676e67 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 f7ce7c7d38..ab7790be81 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.20.0 +// sqlc v1.29.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 3fba9882e7..70b6676e67 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7a5981c738..af96ab9c8b 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..eb98a2bb58 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 0dffd8bd85..3508464217 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..eb98a2bb58 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 67d40a2eb4..e2d7e919c9 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..eb98a2bb58 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 67d40a2eb4..e2d7e919c9 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.20.0 +// sqlc v1.29.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 3fba9882e7..70b6676e67 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 3616d4b785..a3ad626c37 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.20.0 +// sqlc v1.29.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 3fba9882e7..70b6676e67 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 67d40a2eb4..e2d7e919c9 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..eb98a2bb58 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 bc5792ad76..ce92965644 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..eb98a2bb58 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 1da2574802..84da13feea 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 1da2574802..84da13feea 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 ef91322a1a..e969df4c58 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 3433b40c0c..1ee56beb47 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.20.0 +// sqlc v1.29.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 f89822ad6a..2ebdf5dc20 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 4235d52cef..8cd1063e71 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 4235d52cef..8cd1063e71 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 273f1eb1d8..98a7fde0d3 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.20.0 +// sqlc v1.29.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 897fe6372f..de7302452d 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.20.0 +// sqlc v1.29.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 4cadd3e229..91e3b8faa3 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.20.0 +// sqlc v1.29.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 f1f6846cb1..332a25fc83 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.20.0 +// sqlc v1.29.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 f37c47afa7..397edca7ae 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.20.0 +// sqlc v1.29.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 4cadd3e229..91e3b8faa3 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.20.0 +// sqlc v1.29.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 70577c4d8a..9fee02a310 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.20.0 +// sqlc v1.29.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 68692e02d1..ba7419ccd2 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.20.0 +// sqlc v1.29.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 dbe86a6bee..d41e7ef9af 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.20.0 +// sqlc v1.29.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 70577c4d8a..9fee02a310 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.20.0 +// sqlc v1.29.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 897fe6372f..de7302452d 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.20.0 +// sqlc v1.29.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 4cadd3e229..91e3b8faa3 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.20.0 +// sqlc v1.29.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 f1f6846cb1..332a25fc83 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.20.0 +// sqlc v1.29.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 897fe6372f..de7302452d 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.20.0 +// sqlc v1.29.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 b9a3d31b17..dc6b7b6676 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.20.0 +// sqlc v1.29.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 f1f6846cb1..332a25fc83 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.20.0 +// sqlc v1.29.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 552cf4553d..998accfb8f 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.20.0 +// sqlc v1.29.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 6bf464fa9d..cb85a42e28 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.20.0 +// sqlc v1.29.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..99edb91f8b --- /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.29.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 448766bdaa..814523221a 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.20.0 +// sqlc v1.29.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 f30dba1402..272e5ea183 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.20.0 +// sqlc v1.29.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..99edb91f8b --- /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.29.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..dfc3d5029a --- /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.29.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..3cf54692e1 --- /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.29.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..f532acbedc --- /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.29.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 69db5842a6..dfc3d5029a 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.20.0 +// sqlc v1.29.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 3de21ca054..dcc12da4e7 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.20.0 +// sqlc v1.29.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..7420549bd6 --- /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.29.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 441a21dede..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.20.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 2caf00133c..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.20.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 94ad76b2d5..b16389094c 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.20.0 +// sqlc v1.29.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 8fc4d77102..eb6e21f80a 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.20.0 +// sqlc v1.29.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 37df62bb95..a4bc6fc8c6 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.20.0 +// sqlc v1.29.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 2c830b8fe6..592a2c868a 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.20.0 +// sqlc v1.29.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 4a94b23ac3..400a67a359 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.20.0 +// sqlc v1.29.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 94ad76b2d5..b16389094c 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.20.0 +// sqlc v1.29.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 0def4a6e6d..6cb4788a2d 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.20.0 +// sqlc v1.29.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 4a3f93d324..46725b2657 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.20.0 +// sqlc v1.29.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 6038202791..e7a9ed88fd 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.20.0 +// sqlc v1.29.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 9aeb3170d9..70d50483cb 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.20.0 +// sqlc v1.29.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 813f14dc9f..ae682c3831 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..bfa4198e3f --- /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.29.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..a3ce5253aa --- /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.29.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 897fe6372f..de7302452d 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/enum/mysql/go/models.go b/internal/endtoend/testdata/enum/mysql/go/models.go index 5877685feb..241ce68770 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.20.0 +// sqlc v1.29.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 b02f0b83d3..bdec28e0cf 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.20.0 +// sqlc v1.29.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 f37c47afa7..397edca7ae 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.20.0 +// sqlc v1.29.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 5a9b5458dc..6fa82ed2de 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.20.0 +// sqlc v1.29.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 576a599e64..6c733a283d 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.20.0 +// sqlc v1.29.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 68692e02d1..ba7419ccd2 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.20.0 +// sqlc v1.29.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 7919a99f0f..3ce70888ec 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.20.0 +// sqlc v1.29.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 94f57b472c..d9c59cea9c 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.20.0 +// sqlc v1.29.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 897fe6372f..de7302452d 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.20.0 +// sqlc v1.29.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 5a9b5458dc..6fa82ed2de 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.20.0 +// sqlc v1.29.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 749159bd6a..8f65d12da0 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..bb989d9179 --- /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.29.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..1a3386f1d7 --- /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.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 cb73d968da..eb2320bb75 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.20.0 +// sqlc v1.29.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 873d835e37..c70b3f438a 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.20.0 +// sqlc v1.29.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 35bce23b6a..4ba8e01a93 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.20.0 +// sqlc v1.29.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..0c56c2b4e8 --- /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.29.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..a0871d3f1b --- /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.29.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..9eba173a19 --- /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.29.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..0c56c2b4e8 --- /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.29.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..a0871d3f1b --- /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.29.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..7c6f474744 --- /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.29.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..0c56c2b4e8 --- /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.29.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..a0871d3f1b --- /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.29.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..ba5947b978 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 80fd9110b2..c7f1bb0ec2 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.20.0 +// sqlc v1.29.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 db2376043e..7d55d00577 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.20.0 +// sqlc v1.29.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 cbcfd6f0c5..b2881b2f3d 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a9d05078a6..da9cc8a300 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.20.0 +// sqlc v1.29.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 db2376043e..7d55d00577 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.20.0 +// sqlc v1.29.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 cbcfd6f0c5..b2881b2f3d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 80fd9110b2..c7f1bb0ec2 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.20.0 +// sqlc v1.29.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 db2376043e..7d55d00577 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.20.0 +// sqlc v1.29.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 5c6a3296a3..c2ab3ee57f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 b827c1b976..c4de9f7424 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.20.0 +// sqlc v1.29.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 499d4295f8..6f1328682f 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..938af8e836 --- /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.29.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..2fbe4fc260 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 024a15c849..370fb9a4b7 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.20.0 +// sqlc v1.29.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 426174c9d5..285bd4708a 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 e4c9963f06..8be6ced3e9 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.20.0 +// sqlc v1.29.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 211d832aa1..e68b860226 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 7aac445183..e7125d5c2e 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.20.0 +// sqlc v1.29.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 da6da68783..4603c25b76 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.20.0 +// sqlc v1.29.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 a60aa3e7c6..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.20.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 3ce9234abb..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.20.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 2a34916acf..9089ed8ae0 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.20.0 +// sqlc v1.29.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 cb4ed9b8f7..1359ec9af7 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 2a34916acf..9089ed8ae0 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.20.0 +// sqlc v1.29.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 cb4ed9b8f7..1359ec9af7 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 2a34916acf..9089ed8ae0 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.20.0 +// sqlc v1.29.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 adc2852d29..736cfbc8ab 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.20.0 +// sqlc v1.29.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 a60aa3e7c6..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.20.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 7c18f6a8d5..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.20.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 58461fe9a5..940652ea94 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.20.0 +// sqlc v1.29.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 bc37d43461..a6ee1acbf1 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,12 +1,13 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 // source: query.sql package querytest import ( "context" + "database/sql" ) const getAuthor = `-- name: GetAuthor :one @@ -17,10 +18,10 @@ WHERE a.id = ? LIMIT 1 ` type GetAuthorRow struct { - ID int64 - Name string - ID_2 int64 - Title string + ID sql.NullInt64 + Name sql.NullString + ID_2 sql.NullInt64 + Title sql.NullString } func (q *Queries) GetAuthor(ctx context.Context, id int64) (GetAuthorRow, error) { 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 57406b68e8..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.20.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 57e0627980..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.20.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 c5b696adab..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.20.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..a92cd6e8eb --- /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.29.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..d3b600c584 --- /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.29.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..68b52e8c9e --- /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.29.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..a92cd6e8eb --- /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.29.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..d3b600c584 --- /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.29.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..4462889219 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 3abfb9bb34..9a938d917e 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 87824ac2a5..ca781e5d53 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 6bbafca263..75b5f0c414 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 9c8f2ba68c..d290bf5873 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 9c8f2ba68c..d290bf5873 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 25045c3cbd..33f44d1be5 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 908237f250..8e588bd58f 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.20.0 +// sqlc v1.29.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/pgx/v4/go/db.go b/internal/endtoend/testdata/func_call_cast/pgx/v4/go/db.go deleted file mode 100644 index f0ea7fd21a..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v4/go/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.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_call_cast/pgx/v4/go/models.go b/internal/endtoend/testdata/func_call_cast/pgx/v4/go/models.go deleted file mode 100644 index e57c7500db..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v4/go/models.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 - -package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/pgx/v4/go/query.sql.go deleted file mode 100644 index ef5deb917a..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v4/go/query.sql.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/google/uuid" -) - -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) - var col1 uuid.UUID - err := row.Scan(&col1) - return col1, err -} diff --git a/internal/endtoend/testdata/func_call_cast/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_call_cast/pgx/v4/sqlc.json deleted file mode 100644 index 9403bd0279..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v4/sqlc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "sql_package": "pgx/v4", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/func_call_cast/pgx/v5/go/db.go b/internal/endtoend/testdata/func_call_cast/pgx/v5/go/db.go deleted file mode 100644 index e715a0f400..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v5/go/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.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_call_cast/pgx/v5/go/models.go b/internal/endtoend/testdata/func_call_cast/pgx/v5/go/models.go deleted file mode 100644 index e57c7500db..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v5/go/models.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 - -package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/pgx/v5/go/query.sql.go deleted file mode 100644 index 7cde13fbee..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v5/go/query.sql.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/jackc/pgx/v5/pgtype" -) - -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) - var col1 pgtype.UUID - err := row.Scan(&col1) - return col1, err -} diff --git a/internal/endtoend/testdata/func_call_cast/pgx/v5/sqlc.json b/internal/endtoend/testdata/func_call_cast/pgx/v5/sqlc.json deleted file mode 100644 index 6645ccbd1b..0000000000 --- a/internal/endtoend/testdata/func_call_cast/pgx/v5/sqlc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "sql_package": "pgx/v5", - "name": "querytest", - "schema": "query.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 new file mode 100644 index 0000000000..635cce3c5d --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_call_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..c157a76881 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest 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 new file mode 100644 index 0000000000..ea2800330e --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +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, 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/pgx/v4/query.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/query.sql similarity index 100% rename from internal/endtoend/testdata/func_call_cast/pgx/v4/query.sql rename to internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/query.sql 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 new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "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 new file mode 100644 index 0000000000..e83d6a948c --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_call_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..c157a76881 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest 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 new file mode 100644 index 0000000000..f64b3f0fc0 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5/pgtype" +) + +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, 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/pgx/v5/query.sql b/internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/query.sql similarity index 100% rename from internal/endtoend/testdata/func_call_cast/pgx/v5/query.sql rename to internal/endtoend/testdata/func_call_cast/postgresql/pgx/v5/query.sql 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 new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/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_call_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_call_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..c157a76881 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest 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 new file mode 100644 index 0000000000..90df3e10b3 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" + + "github.com/google/uuid" +) + +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, 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/stdlib/query.sql b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/query.sql similarity index 100% rename from internal/endtoend/testdata/func_call_cast/stdlib/query.sql rename to internal/endtoend/testdata/func_call_cast/postgresql/stdlib/query.sql 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 new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/postgresql/stdlib/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_call_cast/sqlite/go/db.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_call_cast/sqlite/go/models.go b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go new file mode 100644 index 0000000000..c157a76881 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/models.go @@ -0,0 +1,5 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest 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 new file mode 100644 index 0000000000..16c361d26f --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/go/query.sql.go @@ -0,0 +1,21 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const demo = `-- name: Demo :one +SELECT CAST(CHAR(1,2,3,4,5) AS BLOB) AS col1 +` + +func (q *Queries) Demo(ctx context.Context) ([]byte, error) { + row := q.db.QueryRowContext(ctx, demo) + var col1 []byte + err := row.Scan(&col1) + return col1, err +} diff --git a/internal/endtoend/testdata/func_call_cast/sqlite/query.sql b/internal/endtoend/testdata/func_call_cast/sqlite/query.sql new file mode 100644 index 0000000000..eb18aad656 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/sqlite/query.sql @@ -0,0 +1,2 @@ +-- name: Demo :one +SELECT CAST(CHAR(1,2,3,4,5) AS BLOB) AS col1 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 new file mode 100644 index 0000000000..95b9cd09c0 --- /dev/null +++ b/internal/endtoend/testdata/func_call_cast/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/func_call_cast/stdlib/go/db.go b/internal/endtoend/testdata/func_call_cast/stdlib/go/db.go deleted file mode 100644 index 57406b68e8..0000000000 --- a/internal/endtoend/testdata/func_call_cast/stdlib/go/db.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.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_call_cast/stdlib/go/models.go b/internal/endtoend/testdata/func_call_cast/stdlib/go/models.go deleted file mode 100644 index e57c7500db..0000000000 --- a/internal/endtoend/testdata/func_call_cast/stdlib/go/models.go +++ /dev/null @@ -1,7 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 - -package querytest - -import () diff --git a/internal/endtoend/testdata/func_call_cast/stdlib/go/query.sql.go b/internal/endtoend/testdata/func_call_cast/stdlib/go/query.sql.go deleted file mode 100644 index a308345397..0000000000 --- a/internal/endtoend/testdata/func_call_cast/stdlib/go/query.sql.go +++ /dev/null @@ -1,23 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 -// source: query.sql - -package querytest - -import ( - "context" - - "github.com/google/uuid" -) - -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) - var col1 uuid.UUID - err := row.Scan(&col1) - return col1, err -} diff --git a/internal/endtoend/testdata/func_call_cast/stdlib/sqlc.json b/internal/endtoend/testdata/func_call_cast/stdlib/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/func_call_cast/stdlib/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_match_types/mysql/go/db.go b/internal/endtoend/testdata/func_match_types/mysql/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c632e6a0bd..50749a47b8 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.20.0 +// sqlc v1.29.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 c7a2eaecae..56fd4ea78a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 df510da334..50749a47b8 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.20.0 +// sqlc v1.29.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 e866fed262..f2dcfcd12c 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae5fac1de8..819cc8867a 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.20.0 +// sqlc v1.29.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 e2c2c46de3..059d14e185 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..53c974680f --- /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.29.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..fe59a01bc5 --- /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.29.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 f0ea7fd21a..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.20.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 6c20e87b00..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.20.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 f0055bca55..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.20.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 5626061d44..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v4/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL -); - -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ BEGIN QUERY -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 e715a0f400..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.20.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 d9e81b6e00..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.20.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 199142073e..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.20.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 5626061d44..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/pgx/v5/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL -); - -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ BEGIN QUERY -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 57406b68e8..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.20.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 6c20e87b00..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.20.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 87e0149ef2..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.20.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 07bd25160f..0000000000 --- a/internal/endtoend/testdata/func_return/postgresql/stdlib/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE users ( - id integer, - first_name varchar(255) NOT NULL -); - -CREATE FUNCTION users_func() RETURNS SETOF users AS $func$ BEGIN QUERY -SELECT * -FROM users -END $func$ LANGUAGE plpgsql; \ No newline at end of file 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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..7a8c17732d --- /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.29.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_date/postgresql/pganalyze/sqlc.json b/internal/endtoend/testdata/func_return_date/postgresql/pganalyze/sqlc.json new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/func_return_date/postgresql/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/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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..1456549f64 --- /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.29.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..a92cd6e8eb --- /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.29.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..c157a76881 --- /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.29.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..5214fdea55 --- /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.29.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..e83d6a948c --- /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.29.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..944393fee2 --- /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.29.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..7f9ef2cd72 --- /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.29.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..635cce3c5d --- /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.29.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..c157a76881 --- /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.29.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..6cef736304 --- /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.29.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_series/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/func_return_series/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "schema": "schema.sql", + "queries": "query.sql" + } + ] +} 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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..6cef736304 --- /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.29.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..a92cd6e8eb --- /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.29.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..c157a76881 --- /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.29.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..9375704aa4 --- /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.29.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..e83d6a948c --- /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.29.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..25d672fc05 --- /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.29.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..274708171f --- /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.29.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..e83d6a948c --- /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.29.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..78ec53a436 --- /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.29.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..2520850e32 --- /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.29.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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..1d994f53b8 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 fcd8170fab..59d95234b0 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.20.0 +// sqlc v1.29.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 5f7e05ff5b..150345d099 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..635cce3c5d --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/geometric/pgx/v4/go/models.go b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go new file mode 100644 index 0000000000..711a9f3776 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/models.go @@ -0,0 +1,26 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "github.com/jackc/pgtype" +) + +type TestTable struct { + VBoxNull pgtype.Box + VCircleNull pgtype.Circle + VLineNull pgtype.Line + VLsegNull pgtype.Lseg + VPathNull pgtype.Path + VPointNull pgtype.Point + VPolygonNull pgtype.Polygon + VBox pgtype.Box + VCircle pgtype.Circle + VLine pgtype.Line + VLseg pgtype.Lseg + VPath pgtype.Path + VPoint pgtype.Point + VPolygon pgtype.Polygon +} diff --git a/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go new file mode 100644 index 0000000000..8ea3843444 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/go/query.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectTest = `-- name: SelectTest :many +SELECT v_box_null, v_circle_null, v_line_null, v_lseg_null, v_path_null, v_point_null, v_polygon_null, v_box, v_circle, v_line, v_lseg, v_path, v_point, v_polygon +from test_table +` + +func (q *Queries) SelectTest(ctx context.Context) ([]TestTable, error) { + rows, err := q.db.Query(ctx, selectTest) + if err != nil { + return nil, err + } + defer rows.Close() + var items []TestTable + for rows.Next() { + var i TestTable + if err := rows.Scan( + &i.VBoxNull, + &i.VCircleNull, + &i.VLineNull, + &i.VLsegNull, + &i.VPathNull, + &i.VPointNull, + &i.VPolygonNull, + &i.VBox, + &i.VCircle, + &i.VLine, + &i.VLseg, + &i.VPath, + &i.VPoint, + &i.VPolygon, + ); 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/geometric/pgx/v4/query.sql b/internal/endtoend/testdata/geometric/pgx/v4/query.sql new file mode 100644 index 0000000000..3ab56eee50 --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/query.sql @@ -0,0 +1,3 @@ +-- 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 new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/geometric/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 9b6292f474..748b2fdeee 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.20.0 +// sqlc v1.29.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 b291917c56..8ea3843444 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.20.0 +// sqlc v1.29.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..0c56c2b4e8 --- /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.29.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..da1c9e708f --- /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.29.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..10822e5e07 --- /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.29.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..0c56c2b4e8 --- /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.29.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..e8eec05ffa --- /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.29.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..d67a70bb14 --- /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.29.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..0c56c2b4e8 --- /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.29.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..89e37f98bb --- /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.29.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..50f15bb7ac --- /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.29.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..0c56c2b4e8 --- /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.29.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..89e37f98bb --- /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.29.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..50f15bb7ac --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/having/mysql/go/models.go b/internal/endtoend/testdata/having/mysql/go/models.go index 2113591823..700add88d1 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.20.0 +// sqlc v1.29.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 3b2b44fcee..c05ffaf141 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/having/postgresql/go/models.go b/internal/endtoend/testdata/having/postgresql/go/models.go index 2113591823..700add88d1 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.20.0 +// sqlc v1.29.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 1101f225e3..910552337e 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.20.0 +// sqlc v1.29.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 df2b233d5a..41c581ae57 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.20.0 +// sqlc v1.29.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 142dd36cc7..b7104a9334 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.20.0 +// sqlc v1.29.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 13d976c17b..3988448528 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.20.0 +// sqlc v1.29.0 package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql b/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql index ff91ac0291..5299011de6 100644 --- a/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql +++ b/internal/endtoend/testdata/hstore/pgx/v4/hstore.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + CREATE TABLE foo ( bar hstore NOT NULL, baz hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/go/db.go b/internal/endtoend/testdata/hstore/pgx/v5/go/db.go index 2d3520ea84..60aba78f98 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.20.0 +// sqlc v1.29.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 8d847eb7d4..3708dcb47d 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.20.0 +// sqlc v1.29.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 15130667d2..2dba72beea 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.20.0 +// sqlc v1.29.0 package hstore diff --git a/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql b/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql index ff91ac0291..5299011de6 100644 --- a/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql +++ b/internal/endtoend/testdata/hstore/pgx/v5/hstore.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + CREATE TABLE foo ( bar hstore NOT NULL, baz hstore diff --git a/internal/endtoend/testdata/hstore/stdlib/go/db.go b/internal/endtoend/testdata/hstore/stdlib/go/db.go index cbef9b8a58..34ce29b03e 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.20.0 +// sqlc v1.29.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 b149307293..2446547cd4 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.20.0 +// sqlc v1.29.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 00319f999a..e18e4db10f 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.20.0 +// sqlc v1.29.0 package hstore -import () - type Foo struct { Bar interface{} Baz interface{} diff --git a/internal/endtoend/testdata/hstore/stdlib/hstore.sql b/internal/endtoend/testdata/hstore/stdlib/hstore.sql index ff91ac0291..5299011de6 100644 --- a/internal/endtoend/testdata/hstore/stdlib/hstore.sql +++ b/internal/endtoend/testdata/hstore/stdlib/hstore.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS hstore; + CREATE TABLE foo ( bar hstore NOT NULL, baz hstore diff --git a/internal/endtoend/testdata/identical_tables/mysql/go/db.go b/internal/endtoend/testdata/identical_tables/mysql/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 645fa25d9a..d23b7bdaaa 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.20.0 +// sqlc v1.29.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 226fe875f8..eddda81803 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 645fa25d9a..d23b7bdaaa 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.20.0 +// sqlc v1.29.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 50d3948b76..a395450150 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 645fa25d9a..d23b7bdaaa 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.20.0 +// sqlc v1.29.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 50d3948b76..a395450150 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 645fa25d9a..d23b7bdaaa 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.20.0 +// sqlc v1.29.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 226fe875f8..eddda81803 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 645fa25d9a..d23b7bdaaa 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.20.0 +// sqlc v1.29.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 226fe875f8..eddda81803 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 825184c6da..601f8ed004 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.20.0 +// sqlc v1.29.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 9cebb08fa1..3c7fd8d3c8 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 d17b91d39d..a0871d3f1b 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.20.0 +// sqlc v1.29.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 f41290e2b6..24bcbb9ffe 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.20.0 +// sqlc v1.29.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 ee805d9459..6b17cdf2dc 100644 --- a/internal/endtoend/testdata/identifier_dollar_sign/query.sql +++ b/internal/endtoend/testdata/identifier_dollar_sign/query.sql @@ -1,4 +1,2 @@ -CREATE FUNCTION f$n() RETURNS integer AS 'SELECT 1'; - -- 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..a92cd6e8eb --- /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.29.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..ca6644b464 --- /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.29.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..34c4295f6f --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/inflection/mysql/go/models.go b/internal/endtoend/testdata/inflection/mysql/go/models.go index 18edb2cbe1..03a11b20aa 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.20.0 +// sqlc v1.29.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 5c28371318..3c0eaacc70 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 18edb2cbe1..03a11b20aa 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.20.0 +// sqlc v1.29.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 9c6e5e8bff..f02d1f9cff 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 18edb2cbe1..03a11b20aa 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.20.0 +// sqlc v1.29.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 9c6e5e8bff..f02d1f9cff 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 18edb2cbe1..03a11b20aa 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.20.0 +// sqlc v1.29.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 5c28371318..3c0eaacc70 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/inflection/sqlite/go/models.go b/internal/endtoend/testdata/inflection/sqlite/go/models.go index 18edb2cbe1..03a11b20aa 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.20.0 +// sqlc v1.29.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 5c28371318..3c0eaacc70 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e2a91a82f1..63ed1fb1e4 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.20.0 +// sqlc v1.29.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 2a2642a47c..cba53bff9b 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e2a91a82f1..63ed1fb1e4 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.20.0 +// sqlc v1.29.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 2a2642a47c..cba53bff9b 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.20.0 +// sqlc v1.29.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 df27511a97..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.20.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 274edec17e..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.20.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 24ef66823e..f1cff592f2 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.20.0 +// sqlc v1.29.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 f41da14b4b..15850d7be8 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 f96def044f..f28620929a 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.20.0 +// sqlc v1.29.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 ccea0f241b..dd91c7af0a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 24ef66823e..f1cff592f2 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.20.0 +// sqlc v1.29.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 2d962d5152..341db48159 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.20.0 +// sqlc v1.29.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_select/mysql/go/db.go b/internal/endtoend/testdata/insert_select/mysql/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 aa1b0d005e..0bca59013c 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.20.0 +// sqlc v1.29.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 9d3a60e8ca..c9fb431f7d 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 aa1b0d005e..0bca59013c 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.20.0 +// sqlc v1.29.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 c98037dacd..e6a867b056 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 aa1b0d005e..0bca59013c 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.20.0 +// sqlc v1.29.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 c98037dacd..e6a867b056 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 aa1b0d005e..0bca59013c 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.20.0 +// sqlc v1.29.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 eaf3b5ab53..bdc9119f92 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 aa1b0d005e..0bca59013c 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.20.0 +// sqlc v1.29.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 9d3a60e8ca..c9fb431f7d 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..09f8061186 --- /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.29.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..fe8feb518c --- /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.29.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..e83d6a948c --- /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.29.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..53c974680f --- /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.29.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..5b3aff5a62 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6dc052389b..f9085a3a98 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.20.0 +// sqlc v1.29.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 3a3678e432..3b49a82faa 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -10,6 +10,27 @@ import ( "database/sql" ) +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt32 + A_2 sql.NullString + B_2 sql.NullInt32 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.ExecContext(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + const insertValues = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES (?, ?) ` diff --git a/internal/endtoend/testdata/insert_values/mysql/query.sql b/internal/endtoend/testdata/insert_values/mysql/query.sql index 78a29ccd39..774165baa8 100644 --- a/internal/endtoend/testdata/insert_values/mysql/query.sql +++ b/internal/endtoend/testdata/insert_values/mysql/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b integer); - /* name: InsertValues :exec */ INSERT INTO foo (a, b) VALUES (?, ?); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?); \ No newline at end of file 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 6dc052389b..f9085a3a98 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.20.0 +// sqlc v1.29.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 8bab543aec..b5bb97d7d2 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -10,6 +10,27 @@ import ( "database/sql" ) +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt32 + A_2 sql.NullString + B_2 sql.NullInt32 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.Exec(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + const insertValues = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2) ` 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 b2ec168840..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,4 +1,5 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4); \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 78783ffd99..beb6668757 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.20.0 +// sqlc v1.29.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 2792d27ce5..b6d8bccbfe 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -11,6 +11,27 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) +` + +type InsertMultipleValuesParams struct { + A pgtype.Text + B pgtype.Int4 + A_2 pgtype.Text + B_2 pgtype.Int4 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.Exec(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + const insertValues = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2) ` 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 b2ec168840..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,4 +1,5 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4); \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6dc052389b..f9085a3a98 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.20.0 +// sqlc v1.29.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 397ce68393..d9eed199a1 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -10,6 +10,27 @@ import ( "database/sql" ) +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt32 + A_2 sql.NullString + B_2 sql.NullInt32 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.ExecContext(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + const insertValues = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2) ` diff --git a/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql b/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql index b2ec168840..0c2b0d6ea4 100644 --- a/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/insert_values/postgresql/stdlib/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b integer); - -- name: InsertValues :exec INSERT INTO foo (a, b) VALUES ($1, $2); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES ($1, $2), ($3, $4); \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7a061d38b4..5b76baff1b 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.20.0 +// sqlc v1.29.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 f89acd1cbd..1b7bd6e0d0 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -10,6 +10,27 @@ import ( "database/sql" ) +const insertMultipleValues = `-- name: InsertMultipleValues :exec +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?) +` + +type InsertMultipleValuesParams struct { + A sql.NullString + B sql.NullInt64 + A_2 sql.NullString + B_2 sql.NullInt64 +} + +func (q *Queries) InsertMultipleValues(ctx context.Context, arg InsertMultipleValuesParams) error { + _, err := q.db.ExecContext(ctx, insertMultipleValues, + arg.A, + arg.B, + arg.A_2, + arg.B_2, + ) + return err +} + const insertValues = `-- name: InsertValues :exec INSERT INTO foo (a, b) VALUES (?, ?) ` diff --git a/internal/endtoend/testdata/insert_values/sqlite/query.sql b/internal/endtoend/testdata/insert_values/sqlite/query.sql index 78a29ccd39..774165baa8 100644 --- a/internal/endtoend/testdata/insert_values/sqlite/query.sql +++ b/internal/endtoend/testdata/insert_values/sqlite/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b integer); - /* name: InsertValues :exec */ INSERT INTO foo (a, b) VALUES (?, ?); + +/* name: InsertMultipleValues :exec */ +INSERT INTO foo (a, b) VALUES (?, ?), (?, ?); \ No newline at end of file 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..e83d6a948c --- /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.29.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..7591b8852e --- /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.29.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..1921b62437 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6dc052389b..f9085a3a98 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.20.0 +// sqlc v1.29.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 7eb22e0638..0853717b17 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 6dc052389b..f9085a3a98 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.20.0 +// sqlc v1.29.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 d7b95bf531..c1ec327155 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 78783ffd99..beb6668757 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.20.0 +// sqlc v1.29.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 8d298dbfa9..8f7488d896 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6dc052389b..f9085a3a98 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.20.0 +// sqlc v1.29.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 5a5194272e..6fc9fed8ec 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 05580832e1..112e5eb6c2 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.20.0 +// sqlc v1.29.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 dc2bb2998e..5c9f898eaa 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 f12d36798f..00bc7d2695 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.20.0 +// sqlc v1.29.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 dc2bb2998e..5c9f898eaa 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/interval/stdlib/go/models.go b/internal/endtoend/testdata/interval/stdlib/go/models.go index 05580832e1..112e5eb6c2 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.20.0 +// sqlc v1.29.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 ecb71286d7..04db44bb81 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.20.0 +// sqlc v1.29.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..0e4c3f4a0b --- /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.29.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..f111047f1c --- /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.29.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..3cf7661d60 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f53e60596d..91782a77be 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.20.0 +// sqlc v1.29.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 d99c040593..a777926833 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 40de05e4ab..3127b64aa8 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.20.0 +// sqlc v1.29.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 3c2037f356..82bfdee47f 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.20.0 +// sqlc v1.29.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 69785fa1fd..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); -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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 12fb810e1e..e9f766614c 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.20.0 +// sqlc v1.29.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 2d407a25de..d7c1c7bc4e 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.20.0 +// sqlc v1.29.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 69785fa1fd..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); -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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 40de05e4ab..3127b64aa8 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.20.0 +// sqlc v1.29.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 922eb72065..3b875a0ed2 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.20.0 +// sqlc v1.29.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 69785fa1fd..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); -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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f41545e729..6ac0246cdc 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.20.0 +// sqlc v1.29.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 4445d3c33d..94cb0e5a26 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 13c4d7f69e..1bf46db0dd 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.20.0 +// sqlc v1.29.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 b95d4472e0..bb72be6724 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 927871180e..5eb75edfb0 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.20.0 +// sqlc v1.29.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 5fd4108153..a48d58aea9 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 927871180e..5eb75edfb0 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.20.0 +// sqlc v1.29.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 e15c4a95b1..e8c2efe37e 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 927871180e..5eb75edfb0 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.20.0 +// sqlc v1.29.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 e15c4a95b1..e8c2efe37e 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 927871180e..5eb75edfb0 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.20.0 +// sqlc v1.29.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 92199ae091..28eb2978b7 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 927871180e..5eb75edfb0 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.20.0 +// sqlc v1.29.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 5fd4108153..a48d58aea9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4530f7ec56..f49da6f044 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.20.0 +// sqlc v1.29.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 d49f2e5f0e..1d3c878814 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.20.0 +// sqlc v1.29.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 76abe8a07c..d5ddf2b01d 100644 --- a/internal/endtoend/testdata/join_full/postgresql/query.sql +++ b/internal/endtoend/testdata/join_full/postgresql/query.sql @@ -1,8 +1,5 @@ -CREATE TABLE foo (id serial not null, bar_id int references bar(id)); -CREATE TABLE bar (id serial not null); - -- name: FullJoin :many SELECT f.id, f.bar_id, b.id FROM foo f FULL OUTER JOIN bar b ON b.id = f.bar_id -WHERE f.id = $1; \ No newline at end of file +WHERE f.id = $1; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1799cf3af6..9f35d6f7d0 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.20.0 +// sqlc v1.29.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 dc99b9835e..bda1b474a9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 451a1f1830..fc60328d04 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.20.0 +// sqlc v1.29.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 b72a0b7aaa..24c49c9827 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6c901eee50..4895f75c32 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.20.0 +// sqlc v1.29.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 e65d889fd8..02b871de96 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 eee117003e..1e91ae2f80 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.20.0 +// sqlc v1.29.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 4d3231e903..0e3091c7a9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 945907dde9..903221ead1 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.20.0 +// sqlc v1.29.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 0039bcaf49..92fb984c9b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -22,8 +22,8 @@ type AllAuthorsRow struct { ID int64 Name string ParentID sql.NullInt64 - ID_2 int64 - Name_2 string + ID_2 sql.NullInt64 + Name_2 sql.NullString ParentID_2 sql.NullInt64 } @@ -68,8 +68,8 @@ type AllAuthorsAliasesRow struct { ID int64 Name string ParentID sql.NullInt64 - ID_2 int64 - Name_2 string + ID_2 sql.NullInt64 + Name_2 sql.NullString ParentID_2 sql.NullInt64 } @@ -114,8 +114,8 @@ type AllAuthorsAliases2Row struct { ID int64 Name string ParentID sql.NullInt64 - ID_2 int64 - Name_2 string + ID_2 sql.NullInt64 + Name_2 sql.NullString ParentID_2 sql.NullInt64 } @@ -160,8 +160,8 @@ type AllSuperAuthorsRow struct { ID int64 Name string ParentID sql.NullInt64 - SuperID int64 - SuperName string + SuperID sql.NullInt64 + SuperName sql.NullString SuperParentID sql.NullInt64 } @@ -206,8 +206,8 @@ type AllSuperAuthorsAliasesRow struct { ID int64 Name string ParentID sql.NullInt64 - SuperID int64 - SuperName string + SuperID sql.NullInt64 + SuperName sql.NullString SuperParentID sql.NullInt64 } @@ -252,8 +252,8 @@ type AllSuperAuthorsAliases2Row struct { ID int64 Name string ParentID sql.NullInt64 - SuperID int64 - SuperName string + SuperID sql.NullInt64 + SuperName sql.NullString SuperParentID sql.NullInt64 } @@ -336,8 +336,8 @@ LEFT JOIN mayors USING (mayor_id) type GetMayorsOptionalRow struct { UserID int64 - CityID int64 - FullName string + CityID sql.NullInt64 + FullName sql.NullString } func (q *Queries) GetMayorsOptional(ctx context.Context) ([]GetMayorsOptionalRow, error) { @@ -382,13 +382,13 @@ type GetSuggestedUsersByIDRow struct { UserBio string UserCreatedAt time.Time UserAvatarID sql.NullInt64 - MediaID int64 - MediaCreatedAt time.Time - MediaHash string - MediaDirectory string - MediaAuthorID int64 - MediaWidth int64 - MediaHeight int64 + MediaID sql.NullInt64 + MediaCreatedAt sql.NullTime + MediaHash sql.NullString + MediaDirectory sql.NullString + MediaAuthorID sql.NullInt64 + MediaWidth sql.NullInt64 + MediaHeight sql.NullInt64 } func (q *Queries) GetSuggestedUsersByID(ctx context.Context, userID int64) ([]GetSuggestedUsersByIDRow, error) { 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a7f8b2104d..75943c31c2 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.20.0 +// sqlc v1.29.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 903f4841b0..827c5d1a86 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a7f8b2104d..75943c31c2 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.20.0 +// sqlc v1.29.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 08a5d45609..11c6aaeb01 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d2c6cee83e..58faf54f02 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.20.0 +// sqlc v1.29.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 dafd7cbb41..ddd49cebb4 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,12 +1,13 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 // source: query.sql package querytest import ( "context" + "database/sql" ) const allAuthors = `-- name: AllAuthors :many @@ -22,8 +23,8 @@ FROM authors AS a type AllAuthorsRow struct { ID int64 Name string - AliasID int64 - AliasName string + AliasID sql.NullInt64 + AliasName sql.NullString } func (q *Queries) AllAuthors(ctx context.Context) ([]AllAuthorsRow, error) { 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..e83d6a948c --- /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.29.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..8ced485579 --- /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.29.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..bdba004a0f --- /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.29.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..e83d6a948c --- /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.29.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..53c974680f --- /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.29.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..406d5d13b1 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1799cf3af6..9f35d6f7d0 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.20.0 +// sqlc v1.29.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 f8586311a0..3665bbd883 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7591c1b5f3..f49da6f044 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.20.0 +// sqlc v1.29.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 adf4871859..e6867b96e5 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4530f7ec56..f49da6f044 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.20.0 +// sqlc v1.29.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 1a82b21487..176b9a9488 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.20.0 +// sqlc v1.29.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 f70c29dd05..f7d9c48d2b 100644 --- a/internal/endtoend/testdata/join_right/postgresql/query.sql +++ b/internal/endtoend/testdata/join_right/postgresql/query.sql @@ -1,8 +1,5 @@ -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 RIGHT JOIN bar b ON b.id = f.bar_id -WHERE f.id = $1; \ No newline at end of file +WHERE f.id = $1; 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8e85509c98..1e8fe9d351 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.20.0 +// sqlc v1.29.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 f726172811..2f459e5991 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 4000a21aa1..1e8fe9d351 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.20.0 +// sqlc v1.29.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 62e91731b5..e30077395a 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.20.0 +// sqlc v1.29.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 c9f0a8557b..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 references bar(id)); - -- 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 69900c6791..79fd8c7325 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.20.0 +// sqlc v1.29.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 62e91731b5..e30077395a 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.20.0 +// sqlc v1.29.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 c9f0a8557b..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 references bar(id)); - -- 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4000a21aa1..1e8fe9d351 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.20.0 +// sqlc v1.29.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 e6a14c0935..48fa6878df 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.20.0 +// sqlc v1.29.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 c9f0a8557b..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 references bar(id)); - -- 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 83542791e2..f73f054b4f 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.20.0 +// sqlc v1.29.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 759e4b5cd9..ee35ae2032 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c34f07696f..3b1c418ad6 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.20.0 +// sqlc v1.29.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 b04a3d90b5..21acf50fd0 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 687d063ab4..aca8f35733 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.20.0 +// sqlc v1.29.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 c4f735fa38..73cc1e5aeb 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 687d063ab4..aca8f35733 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.20.0 +// sqlc v1.29.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 c4f735fa38..73cc1e5aeb 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 687d063ab4..aca8f35733 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.20.0 +// sqlc v1.29.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 b04a3d90b5..21acf50fd0 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 30f8ed551a..217b0337a7 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.20.0 +// sqlc v1.29.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 b04a3d90b5..21acf50fd0 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..2198aa3eb2 --- /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.29.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..27994c660f --- /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.29.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..e83d6a948c --- /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.29.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..e24055879a --- /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.29.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..d92802adf8 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 96add841ad..858b8f4c74 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.20.0 +// sqlc v1.29.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 a4b17ddf86..9f37c6272a 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,76 @@ import ( "context" ) +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ? +` + +type JoinNoConstraintsParams struct { + ID uint64 + Owner string +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var barid uint64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ? +` + +type JoinParamWhereClauseParams struct { + ID uint64 + Owner string +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var barid uint64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const joinWhereClause = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo diff --git a/internal/endtoend/testdata/join_where_clause/mysql/query.sql b/internal/endtoend/testdata/join_where_clause/mysql/query.sql index edcf7c2a5c..bdff39a5ba 100644 --- a/internal/endtoend/testdata/join_where_clause/mysql/query.sql +++ b/internal/endtoend/testdata/join_where_clause/mysql/query.sql @@ -1,8 +1,17 @@ -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 JOIN bar ON bar.id = barid WHERE owner = ?; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ?; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ?; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 91b11898a6..a9b6c4a120 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.20.0 +// sqlc v1.29.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 98061a8431..d5dd7cfd04 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,70 @@ import ( "context" ) +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1 +` + +type JoinNoConstraintsParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinNoConstraints, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1 +` + +type JoinParamWhereClauseParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinParamWhereClause, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const joinWhereClause = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo 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 885042098d..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,8 +1,17 @@ -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 JOIN bar ON bar.id = barid WHERE owner = $1; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1; \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 91b11898a6..a9b6c4a120 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.20.0 +// sqlc v1.29.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 98061a8431..d5dd7cfd04 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,70 @@ import ( "context" ) +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1 +` + +type JoinNoConstraintsParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinNoConstraints, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1 +` + +type JoinParamWhereClauseParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { + rows, err := q.db.Query(ctx, joinParamWhereClause, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const joinWhereClause = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo 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 885042098d..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,8 +1,17 @@ -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 JOIN bar ON bar.id = barid WHERE owner = $1; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 91b11898a6..a9b6c4a120 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.20.0 +// sqlc v1.29.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 778dc0546c..c7296d46e0 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,76 @@ import ( "context" ) +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1 +` + +type JoinNoConstraintsParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1 +` + +type JoinParamWhereClauseParams struct { + Owner string + ID int32 +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.Owner, arg.ID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var barid int32 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const joinWhereClause = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo 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 885042098d..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,8 +1,17 @@ -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 JOIN bar ON bar.id = barid WHERE owner = $1; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = $2 +WHERE owner = $1; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = $2 AND owner = $1; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d4435c7a6c..db98fe788b 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.20.0 +// sqlc v1.29.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 a15ee4ab87..8c30a0d14b 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,76 @@ import ( "context" ) +const joinNoConstraints = `-- name: JoinNoConstraints :many +SELECT foo.barid +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ? +` + +type JoinNoConstraintsParams struct { + ID int64 + Owner string +} + +func (q *Queries) JoinNoConstraints(ctx context.Context, arg JoinNoConstraintsParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, joinNoConstraints, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var barid int64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const joinParamWhereClause = `-- name: JoinParamWhereClause :many +SELECT foo.barid +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ? +` + +type JoinParamWhereClauseParams struct { + ID int64 + Owner string +} + +func (q *Queries) JoinParamWhereClause(ctx context.Context, arg JoinParamWhereClauseParams) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, joinParamWhereClause, arg.ID, arg.Owner) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int64 + for rows.Next() { + var barid int64 + if err := rows.Scan(&barid); err != nil { + return nil, err + } + items = append(items, barid) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const joinWhereClause = `-- name: JoinWhereClause :many SELECT foo.barid FROM foo diff --git a/internal/endtoend/testdata/join_where_clause/sqlite/query.sql b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql index 1a95284227..2b5ae53b00 100644 --- a/internal/endtoend/testdata/join_where_clause/sqlite/query.sql +++ b/internal/endtoend/testdata/join_where_clause/sqlite/query.sql @@ -1,8 +1,17 @@ -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 JOIN bar ON bar.id = barid WHERE owner = ?; + +-- name: JoinParamWhereClause :many +SELECT foo.* +FROM foo +JOIN bar ON bar.id = ? +WHERE owner = ?; + +-- name: JoinNoConstraints :many +SELECT foo.* +FROM foo +CROSS JOIN bar +WHERE bar.id = ? AND owner = ?; \ No newline at end of file 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..4e626d6ff8 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/json/mysql/go/models.go b/internal/endtoend/testdata/json/mysql/go/models.go index 34c72bff96..f0c7d1d47b 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.20.0 +// sqlc v1.29.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 4e777cbdb1..a19e0e4aab 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 6e1e10b2c0..f4bd1d1531 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.20.0 +// sqlc v1.29.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 c76a9cecf5..3293175934 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a4a898da98..1932ce7f53 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.20.0 +// sqlc v1.29.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 c76a9cecf5..3293175934 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 44e7c5d63a..0feb385ba9 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.20.0 +// sqlc v1.29.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 28503ba467..fe9febf8b6 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..7671b865e9 --- /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.29.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..e8cfe37504 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 615acc1f3e..8255c2216d 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 768d768666..0938fba823 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 b608e753f4..68d37e6932 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..74094fd745 --- /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.29.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..76c1f761ab --- /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.29.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..a92cd6e8eb --- /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.29.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..d498cc503e --- /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.29.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..2b29e97a61 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 13e8d27738..c453c44a82 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.20.0 +// sqlc v1.29.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 688bb65195..cb10d7ee76 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 17940760e6..c9a25cc09b 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.20.0 +// sqlc v1.29.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 688bb65195..cb10d7ee76 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 13e8d27738..c453c44a82 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.20.0 +// sqlc v1.29.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 df5db7c3b7..64a0e4ae59 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 15e5b6e7ba..42d1512298 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.20.0 +// sqlc v1.29.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 688bb65195..cb10d7ee76 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 ed52b898d3..f9eb8842e0 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.20.0 +// sqlc v1.29.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 688bb65195..cb10d7ee76 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 15e5b6e7ba..42d1512298 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.20.0 +// sqlc v1.29.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 df5db7c3b7..64a0e4ae59 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 dd21583dc3..ed54fcc159 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.20.0 +// sqlc v1.29.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 688bb65195..cb10d7ee76 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 49efaad63c..e8edf6790f 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.20.0 +// sqlc v1.29.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 688bb65195..cb10d7ee76 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 dd21583dc3..ed54fcc159 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.20.0 +// sqlc v1.29.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 df5db7c3b7..64a0e4ae59 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 e00b1bf2c7..c0deba63cf 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.20.0 +// sqlc v1.29.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 9f2a2c85b3..2f6976d586 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 c1989fb178..ba1b89bcf4 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.20.0 +// sqlc v1.29.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 9f2a2c85b3..2f6976d586 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 6268229f1e..b5059efc65 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.20.0 +// sqlc v1.29.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 9f2a2c85b3..2f6976d586 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 c1989fb178..ba1b89bcf4 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.20.0 +// sqlc v1.29.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 9f2a2c85b3..2f6976d586 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 c1989fb178..ba1b89bcf4 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.20.0 +// sqlc v1.29.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 9f2a2c85b3..2f6976d586 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..1932ce7f53 --- /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.29.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..1d7532f6ec --- /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.29.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..a92cd6e8eb --- /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.29.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..7c4f7cd8c7 --- /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.29.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..9c0858a9c3 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/limit/mysql/go/models.go b/internal/endtoend/testdata/limit/mysql/go/models.go index 61a5ede796..459eece160 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.20.0 +// sqlc v1.29.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 82bffae44d..8daa769b23 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 61a5ede796..459eece160 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.20.0 +// sqlc v1.29.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 31b0879934..a2356d3fd4 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 61a5ede796..459eece160 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.20.0 +// sqlc v1.29.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 31b0879934..a2356d3fd4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/limit/sqlite/go/models.go b/internal/endtoend/testdata/limit/sqlite/go/models.go index 61a5ede796..459eece160 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.20.0 +// sqlc v1.29.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 c8cd78a613..e2b3be3954 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/limit/stdlib/go/models.go b/internal/endtoend/testdata/limit/stdlib/go/models.go index 61a5ede796..459eece160 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.20.0 +// sqlc v1.29.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 462fc28ac7..8bb5e71065 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 869aacb8a1..3eaf9dccdc 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.20.0 +// sqlc v1.29.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 0dbc66be94..20f9d19b36 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 869aacb8a1..3eaf9dccdc 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.20.0 +// sqlc v1.29.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 0dbc66be94..20f9d19b36 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/lower/stdlib/go/models.go b/internal/endtoend/testdata/lower/stdlib/go/models.go index 869aacb8a1..3eaf9dccdc 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.20.0 +// sqlc v1.29.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 e04f1903a0..addea8a201 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 869aacb8a1..3eaf9dccdc 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.20.0 +// sqlc v1.29.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 99b3abb553..b3a1bf5f96 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 869aacb8a1..3eaf9dccdc 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.20.0 +// sqlc v1.29.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 99b3abb553..b3a1bf5f96 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 869aacb8a1..3eaf9dccdc 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.20.0 +// sqlc v1.29.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 0cac6588f0..98b5401e74 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 332ab2dd38..4d75e3f866 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.20.0 +// sqlc v1.29.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..076f8d3574 --- /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.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 525c4d4faa..86170d1417 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.20.0 +// sqlc v1.29.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..076f8d3574 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 332ab2dd38..4d75e3f866 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.20.0 +// sqlc v1.29.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..f718c7497f --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 900e383a87..2771654a01 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.20.0 +// sqlc v1.29.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 da35fa8246..31c48f5af0 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 900e383a87..2771654a01 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.20.0 +// sqlc v1.29.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 da35fa8246..31c48f5af0 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 900e383a87..2771654a01 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.20.0 +// sqlc v1.29.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 36cdac243a..27bc27dbf4 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..a6842616bf --- /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.29.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..3d63ba49ef --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 dbb1254e4e..66c9c4ae3d 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.20.0 +// sqlc v1.29.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 e908e43b21..200d58d0b5 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a9a4d1d992..feba68a3b6 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.20.0 +// sqlc v1.29.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 0af40b3399..b230625900 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 de2e806a0f..3cebd6e33e 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.20.0 +// sqlc v1.29.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 5d4e672b69..be817356a7 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 5b83c7e3cd..e412a8ebd0 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.20.0 +// sqlc v1.29.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 9c162ef225..892a6a685d 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 5b83c7e3cd..e412a8ebd0 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.20.0 +// sqlc v1.29.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 9c162ef225..892a6a685d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 5b83c7e3cd..e412a8ebd0 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.20.0 +// sqlc v1.29.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 8f13d46356..397dd5d161 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 4000a21aa1..1e8fe9d351 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.20.0 +// sqlc v1.29.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 4ea37504b9..defc09a9ff 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v4/query.sql b/internal/endtoend/testdata/multischema/pgx/v4/query.sql index 10ea52a108..926eec234b 100644 --- a/internal/endtoend/testdata/multischema/pgx/v4/query.sql +++ b/internal/endtoend/testdata/multischema/pgx/v4/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/pgx/v5/go/db.go b/internal/endtoend/testdata/multischema/pgx/v5/go/db.go index e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 69900c6791..79fd8c7325 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.20.0 +// sqlc v1.29.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 4ea37504b9..defc09a9ff 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/pgx/v5/query.sql b/internal/endtoend/testdata/multischema/pgx/v5/query.sql index 10ea52a108..926eec234b 100644 --- a/internal/endtoend/testdata/multischema/pgx/v5/query.sql +++ b/internal/endtoend/testdata/multischema/pgx/v5/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: ListBar :many SELECT * FROM bar; diff --git a/internal/endtoend/testdata/multischema/stdlib/go/db.go b/internal/endtoend/testdata/multischema/stdlib/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/go/models.go b/internal/endtoend/testdata/multischema/stdlib/go/models.go index 4000a21aa1..1e8fe9d351 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.20.0 +// sqlc v1.29.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 f9fa780681..f08c928291 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/multischema/stdlib/query.sql b/internal/endtoend/testdata/multischema/stdlib/query.sql index 10ea52a108..926eec234b 100644 --- a/internal/endtoend/testdata/multischema/stdlib/query.sql +++ b/internal/endtoend/testdata/multischema/stdlib/query.sql @@ -1,5 +1,5 @@ CREATE TABLE bar (id serial not null); -CREATE TABLE foo (id serial not null, bar serial references bar(id)); +CREATE TABLE foo (id serial not null, bar serial); -- name: ListBar :many SELECT * FROM bar; 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..a92cd6e8eb --- /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.29.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..30c0f25e8e --- /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.29.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..8ae06e2332 --- /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.29.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 daabcb621e..ccb2634180 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.20.0 +// sqlc v1.29.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 2cd7755900..d7752885c4 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.20.0 +// sqlc v1.29.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 6544ef04ad..4b17764d6b 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.20.0 +// sqlc v1.29.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 c5f77ffe24..c02776d1e4 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.20.0 +// sqlc v1.29.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 55e52f0516..18447b2782 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.20.0 +// sqlc v1.29.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 407babb381..61a96370e4 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.20.0 +// sqlc v1.29.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 430a7ec0cb..3c8857d759 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..e604dea9f3 --- /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.29.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..cb151968e3 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 b6c3497115..ae8e1a8073 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.20.0 +// sqlc v1.29.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 01027a6fbc..8335637ee1 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 b6c3497115..ae8e1a8073 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.20.0 +// sqlc v1.29.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 01027a6fbc..8335637ee1 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b6c3497115..ae8e1a8073 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.20.0 +// sqlc v1.29.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 95acfc6f2a..22e6ecd208 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b6c3497115..ae8e1a8073 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.20.0 +// sqlc v1.29.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 6398290f93..8186b365c2 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..2d70fa3540 --- /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.29.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..561aebb4dc --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/nextval/postgresql/go/models.go b/internal/endtoend/testdata/nextval/postgresql/go/models.go index b57e86e28d..39f88b4e22 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.20.0 +// sqlc v1.29.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 5329381edf..3475565717 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 20154b0fe5..e6957cc1c8 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.20.0 +// sqlc v1.29.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 f7344cf1ba..32ede07158 100644 --- a/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/notifylisten/postgresql/pgx/v5/sqlc.json @@ -6,8 +6,8 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", - "queries": "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..0c56c2b4e8 --- /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.29.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..851016474c --- /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.29.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..ef90f51f52 --- /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.29.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..0c56c2b4e8 --- /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.29.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..851016474c --- /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.29.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..c0e4a0764e --- /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.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 13d90d4db7..cd6f5908a5 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.20.0 +// sqlc v1.29.0 package db @@ -219,6 +219,48 @@ 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 QueryParamEnumTable struct { ID int32 Other QueryParamEnumTableEnum @@ -229,3 +271,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 5f608dc723..6cb813b458 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.20.0 +// sqlc v1.29.0 // source: query.sql package db @@ -90,3 +90,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..599a227482 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,7 @@ 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; 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..486119c334 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,12 @@ 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 +) 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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 825184c6da..601f8ed004 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.20.0 +// sqlc v1.29.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 120f867472..d548f41ede 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 825184c6da..601f8ed004 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.20.0 +// sqlc v1.29.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 05db9d7bf8..fb76727c52 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 04174f5993..6b041d9ca8 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.20.0 +// sqlc v1.29.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 0f503c0729..e8cb497ca7 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 04174f5993..6b041d9ca8 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.20.0 +// sqlc v1.29.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 54aba0655b..e8cb497ca7 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 04174f5993..6b041d9ca8 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.20.0 +// sqlc v1.29.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 f6bbb38af5..100d297c15 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 57e0627980..d3b600c584 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.20.0 +// sqlc v1.29.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 65fcc7934f..de8df7f9e1 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..d3b600c584 --- /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.29.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..58fad16bf6 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 57e0627980..d3b600c584 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.20.0 +// sqlc v1.29.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 fd0d40f560..04cb80ca3c 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1d704a27b6..89a3f80ec1 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.20.0 +// sqlc v1.29.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 ca86d241ef..231ea10c70 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 0db6ffb55a..8a32002896 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.20.0 +// sqlc v1.29.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 ca86d241ef..231ea10c70 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.20.0 +// sqlc v1.29.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 efd2bad11c..c185a64add 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..5bb5b674b2 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v4/go/copyfrom_gen.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: copyfrom_gen.go + +package querytest + +import ( + "context" +) + +// iteratorForUsersC implements pgx.CopyFromSource. +type iteratorForUsersC struct { + rows []int64 + skippedFirstNextCall bool +} + +func (r *iteratorForUsersC) 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 iteratorForUsersC) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForUsersC) Err() error { + return nil +} + +func (q *Queries) UsersC(ctx context.Context, id []int64) (int64, error) { + return q.db.CopyFrom(ctx, []string{"user"}, []string{"id"}, &iteratorForUsersC{rows: id}) +} 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 4a94b23ac3..ab6e9fba25 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.20.0 +// sqlc v1.29.0 package querytest @@ -15,6 +15,7 @@ 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) SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } 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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 93fb924315..5020fd4f19 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.20.0 +// sqlc v1.29.0 package querytest @@ -11,6 +11,7 @@ import ( type Querier interface { User(ctx context.Context) ([]int64, error) UsersB(ctx context.Context, id []int64) *UsersBBatchResults + UsersC(ctx context.Context, id []int64) (int64, error) } var _ Querier = (*Queries)(nil) 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 ba8dda8529..7c1301ce7c 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.20.0 +// sqlc v1.29.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 ef6ee90544..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,8 +1,12 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; -- name: UsersB :batchmany SELECT * FROM "user" WHERE id = $1; + +-- name: UsersC :copyfrom +INSERT INTO "user" +(id) +VALUES +($1); 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 3926a6d114..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,13 +6,14 @@ "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", "output_db_file_name": "db_gen.go", "output_models_file_name": "models_gen.go", - "output_querier_file_name": "querier_gen.go" + "output_querier_file_name": "querier_gen.go", + "output_copyfrom_file_name": "copyfrom_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 8376691698..4dda18feb7 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..5bb5b674b2 --- /dev/null +++ b/internal/endtoend/testdata/output_file_names/pgx/v5/go/copyfrom_gen.go @@ -0,0 +1,42 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: copyfrom_gen.go + +package querytest + +import ( + "context" +) + +// iteratorForUsersC implements pgx.CopyFromSource. +type iteratorForUsersC struct { + rows []int64 + skippedFirstNextCall bool +} + +func (r *iteratorForUsersC) 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 iteratorForUsersC) Values() ([]interface{}, error) { + return []interface{}{ + r.rows[0], + }, nil +} + +func (r iteratorForUsersC) Err() error { + return nil +} + +func (q *Queries) UsersC(ctx context.Context, id []int64) (int64, error) { + return q.db.CopyFrom(ctx, []string{"user"}, []string{"id"}, &iteratorForUsersC{rows: id}) +} 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 6038202791..3dbdf9b2a6 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.20.0 +// sqlc v1.29.0 package querytest @@ -15,6 +15,7 @@ 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) SendBatch(context.Context, *pgx.Batch) pgx.BatchResults } 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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 93fb924315..5020fd4f19 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.20.0 +// sqlc v1.29.0 package querytest @@ -11,6 +11,7 @@ import ( type Querier interface { User(ctx context.Context) ([]int64, error) UsersB(ctx context.Context, id []int64) *UsersBBatchResults + UsersC(ctx context.Context, id []int64) (int64, error) } var _ Querier = (*Queries)(nil) 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 ba8dda8529..7c1301ce7c 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.20.0 +// sqlc v1.29.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 ef6ee90544..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,8 +1,12 @@ -CREATE TABLE "user" (id bigserial not null); - -- name: User :many SELECT "user".* FROM "user"; -- name: UsersB :batchmany SELECT * FROM "user" WHERE id = $1; + +-- name: UsersC :copyfrom +INSERT INTO "user" +(id) +VALUES + ($1); 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 105a8a2ef4..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,13 +6,14 @@ "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", "output_db_file_name": "db_gen.go", "output_models_file_name": "models_gen.go", - "output_querier_file_name": "querier_gen.go" + "output_querier_file_name": "querier_gen.go", + "output_copyfrom_file_name": "copyfrom_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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 81541a0b15..f602b59fa8 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.20.0 +// sqlc v1.29.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 98464ad3b1..f95c7eb71f 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.20.0 +// sqlc v1.29.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 822f727f54..677f10a908 100644 --- a/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json +++ b/internal/endtoend/testdata/output_file_names/stdlib/sqlc.json @@ -4,12 +4,13 @@ { "path": "go", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", "emit_interface": true, "output_db_file_name": "db_gen.go", "output_models_file_name": "models_gen.go", - "output_querier_file_name": "querier_gen.go" + "output_querier_file_name": "querier_gen.go", + "output_copyfrom_file_name": "copyfrom_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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 ba8dda8529..7c1301ce7c 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 ba8dda8529..7c1301ce7c 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 98464ad3b1..f95c7eb71f 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.20.0 +// sqlc v1.29.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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.0 package override diff --git a/internal/endtoend/testdata/overrides/mysql/go/models.go b/internal/endtoend/testdata/overrides/mysql/go/models.go index 7e726c157f..9a6f533b19 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.20.0 +// sqlc v1.29.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..5a9ac42c22 --- /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.29.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 a1299b5937..0c4e025868 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.20.0 +// sqlc v1.29.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 75f8242956..47140f9fad 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.20.0 +// sqlc v1.29.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..0591b6e433 --- /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.29.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 16edbcd3d3..9e1863b7cb 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.20.0 +// sqlc v1.29.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 75f8242956..47140f9fad 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.20.0 +// sqlc v1.29.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..0591b6e433 --- /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.29.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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 75f8242956..47140f9fad 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.20.0 +// sqlc v1.29.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..5a9ac42c22 --- /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.29.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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.0 package override diff --git a/internal/endtoend/testdata/overrides/sqlite/go/models.go b/internal/endtoend/testdata/overrides/sqlite/go/models.go index 7e726c157f..9a6f533b19 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.20.0 +// sqlc v1.29.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..ca39d1c12e --- /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.29.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 bd444c6987..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 string[] -); - -- name: GetAuthor :one SELECT * FROM authors -WHERE id = $1 LIMIT 1; \ No newline at end of file +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 62ee6bfe3d..f3ee589d2f 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.20.0 +// sqlc v1.29.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 f69cf69088..1b7bbe511e 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.20.0 +// sqlc v1.29.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 f9c3947d0c..6902f5f9b3 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.20.0 +// sqlc v1.29.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 bd444c6987..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 string[] -); - -- name: GetAuthor :one SELECT * FROM authors -WHERE id = $1 LIMIT 1; \ No newline at end of file +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 9aecd1dd3e..6cdd791c99 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.20.0 +// sqlc v1.29.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 f82a1aee88..ed9ba58bba 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.20.0 +// sqlc v1.29.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 f9c3947d0c..6902f5f9b3 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.20.0 +// sqlc v1.29.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 bd444c6987..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 string[] -); - -- name: GetAuthor :one SELECT * FROM authors -WHERE id = $1 LIMIT 1; \ No newline at end of file +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 8099a596dc..efa4c515ea 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.20.0 +// sqlc v1.29.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 f69cf69088..1b7bbe511e 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.20.0 +// sqlc v1.29.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 c2d617e8ac..52502a1ec2 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.20.0 +// sqlc v1.29.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..0c56c2b4e8 --- /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.29.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..c7eb2458be --- /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.29.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..cdf5e3f442 --- /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.29.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..0c56c2b4e8 --- /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.29.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..c7eb2458be --- /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.29.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..cdf5e3f442 --- /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.29.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..0c56c2b4e8 --- /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.29.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..c7eb2458be --- /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.29.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..cdf5e3f442 --- /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.29.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 4624d612a9..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: Failed to parse Go struct tag: no colon in field "abc" +# 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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 5942323c9c..5cb2b2ffda 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,11 +1,9 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package override -import () - type Bar struct { Other string AlsoTagged string `also:"tagged"` 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..5a9ac42c22 --- /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.29.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/postgresql/pgx/v4/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v4/go/db.go index a1299b5937..0c4e025868 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.20.0 +// sqlc v1.29.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 87ef92638a..76b9f6a98b 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,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package override 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..0591b6e433 --- /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.29.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/v5/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/pgx/v5/go/db.go index 16edbcd3d3..9e1863b7cb 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.20.0 +// sqlc v1.29.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 f5e5ce4236..2f13a354c5 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,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package override 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..0591b6e433 --- /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.29.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/stdlib/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/postgresql/stdlib/go/db.go index aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 daf9c318c9..4d4b68eba2 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,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package override 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..5a9ac42c22 --- /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.29.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/sqlite/go/db.go b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/go/db.go index aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 5942323c9c..897282f3be 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,22 +1,23 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.20.0 +// sqlc v1.29.0 package override -import () - type Bar struct { Other string AlsoTagged string `also:"tagged"` + Tag3 string `tag_with_space:" it's legal!"` } type Baz struct { Other string AlsoTagged string `also:"tagged"` + Tag3 string `tag_with_space:" it's legal!"` } type Foo struct { Other string Tagged string `a:"b" x:"y,z"` + Tag3 string `tag_with_space:" it's legal!"` } 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..ca39d1c12e --- /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.29.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 4d5233cc37..f908060db1 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/schema.sql @@ -1,14 +1,17 @@ CREATE TABLE foo ( other text NOT NULL, - tagged text NOT NULL + tagged text NOT NULL, + tag3 text NOT NULL ); CREATE TABLE bar ( other text NOT NULL, - also_tagged text NOT NULL + also_tagged text NOT NULL, + tag3 text NOT NULL ); CREATE TABLE baz ( other text NOT NULL, - also_tagged text NOT NULL + also_tagged text NOT NULL, + tag3 text NOT NULL ); 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 0be626d449..a4d54cc3df 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_struct_tags/sqlite/sqlc.json @@ -15,6 +15,10 @@ { "go_struct_tag": "also:\"tagged\"", "column": "*.also_tagged" + }, + { + "go_struct_tag": "tag_with_space:\" it's legal!\"", + "column": "*.tag3" } ] } 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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 776993fc41..f41ed7c844 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.20.0 +// sqlc v1.29.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 181d7ac2bc..a3cbc333c5 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.20.0 +// sqlc v1.29.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 a1299b5937..0c4e025868 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.20.0 +// sqlc v1.29.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 64a58dbf70..0cb364b2be 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.20.0 +// sqlc v1.29.0 package override @@ -19,7 +19,7 @@ type Bar struct { OtherID fuid.UUID MoreID fuid.UUID Age sql.NullInt32 - Balance interface{} + Balance sql.NullFloat64 Bio sql.NullString About sql.NullString } 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 6ec74512f3..735aaae4a8 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.20.0 +// sqlc v1.29.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql index 04551110f3..68d2f8375f 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/schema.sql @@ -2,7 +2,7 @@ CREATE TABLE foo ( id uuid NOT NULL, other_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); @@ -12,7 +12,7 @@ CREATE TABLE bar ( other_id uuid NOT NULL, more_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json index 238b937a36..80f4577b9d 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v4/sqlc.json @@ -15,7 +15,7 @@ "import": "github.com/gofrs/uuid", "package": "uuid", "type": "UUID" - }, + } }, { "column": "*.*_id", @@ -23,7 +23,7 @@ "import": "github.com/gofrs/uuid", "package": "fuid", "type": "UUID" - }, + } }, { "column": "foo.age", @@ -32,7 +32,7 @@ "import": "database/sql", "package": "orm", "type": "NullInt32" - }, + } }, { "column": "foo.balance", @@ -40,7 +40,7 @@ "go_type": { "import": "github.com/volatiletech/null/v8", "type": "Float32" - }, + } }, { "column": "foo.bio", @@ -48,7 +48,7 @@ "go_type": { "import": "gopkg.in/guregu/null.v4", "type": "String" - }, + } }, { "column": "foo.about", 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 16edbcd3d3..9e1863b7cb 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.20.0 +// sqlc v1.29.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 62226c5147..15bac34292 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.20.0 +// sqlc v1.29.0 package override @@ -18,7 +18,7 @@ type Bar struct { OtherID fuid.UUID MoreID fuid.UUID Age pgtype.Int4 - Balance interface{} + Balance pgtype.Float8 Bio pgtype.Text About pgtype.Text } 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 d14e6dc6b3..fd1e3fe367 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.20.0 +// sqlc v1.29.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql index 04551110f3..68d2f8375f 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/schema.sql @@ -2,7 +2,7 @@ CREATE TABLE foo ( id uuid NOT NULL, other_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); @@ -12,7 +12,7 @@ CREATE TABLE bar ( other_id uuid NOT NULL, more_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json index fa238bdae8..5baf32800b 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/pgx/v5/sqlc.json @@ -15,7 +15,7 @@ "import": "github.com/gofrs/uuid", "package": "uuid", "type": "UUID" - }, + } }, { "column": "*.*_id", @@ -23,7 +23,7 @@ "import": "github.com/gofrs/uuid", "package": "fuid", "type": "UUID" - }, + } }, { "column": "foo.age", @@ -32,7 +32,7 @@ "import": "database/sql", "package": "orm", "type": "NullInt32" - }, + } }, { "column": "foo.balance", @@ -40,7 +40,7 @@ "go_type": { "import": "github.com/volatiletech/null/v8", "type": "Float32" - }, + } }, { "column": "foo.bio", @@ -48,7 +48,7 @@ "go_type": { "import": "gopkg.in/guregu/null.v4", "type": "String" - }, + } }, { "column": "foo.about", 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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 4979782a53..0b0c291de2 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.20.0 +// sqlc v1.29.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 f08eee6a4e..1719cb24b3 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.20.0 +// sqlc v1.29.0 // source: query.sql package override diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql index 4e0d1f5af7..6e33abfeb1 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/schema.sql @@ -2,7 +2,7 @@ CREATE TABLE foo ( id uuid NOT NULL, other_id uuid NOT NULL, age integer, - balance double, + balance double precision, bio text, about text ); diff --git a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json index 8d3b0c2223..c97894fd2a 100644 --- a/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json +++ b/internal/endtoend/testdata/overrides_go_types/postgresql/stdlib/sqlc.json @@ -13,7 +13,7 @@ "go_type": { "import": "github.com/gofrs/uuid", "type": "UUID" - }, + } }, { "column": "foo.other_id", @@ -21,7 +21,7 @@ "import": "github.com/gofrs/uuid", "package": "fuid", "type": "UUID" - }, + } }, { "column": "foo.age", @@ -30,7 +30,7 @@ "import": "database/sql", "package": "orm", "type": "NullInt32" - }, + } }, { "column": "foo.balance", @@ -38,7 +38,7 @@ "go_type": { "import": "github.com/volatiletech/null/v8", "type": "Float32" - }, + } }, { "column": "foo.bio", @@ -46,7 +46,7 @@ "go_type": { "import": "gopkg.in/guregu/null.v4", "type": "String" - }, + } }, { "column": "foo.about", 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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 776993fc41..f41ed7c844 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.20.0 +// sqlc v1.29.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..ca39d1c12e --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d611ea8c84..6d1c438826 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.20.0 +// sqlc v1.29.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 fc42863d11..1b2b269c23 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 4bd65b5828..9c6c0135b3 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.20.0 +// sqlc v1.29.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 fc42863d11..1b2b269c23 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d611ea8c84..6d1c438826 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.20.0 +// sqlc v1.29.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 5b7eb97231..b413b8b8f2 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.20.0 +// sqlc v1.29.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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 e4bc4dc5a8..35d32a552a 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.20.0 +// sqlc v1.29.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 f37389e0a4..fa21b0e3fa 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.20.0 +// sqlc v1.29.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 a1299b5937..0c4e025868 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.20.0 +// sqlc v1.29.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 3322ce8933..c7f52ef6be 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.20.0 +// sqlc v1.29.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 3147e3d736..9a033bade1 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.20.0 +// sqlc v1.29.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 16edbcd3d3..9e1863b7cb 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.20.0 +// sqlc v1.29.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 3322ce8933..c7f52ef6be 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.20.0 +// sqlc v1.29.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 3147e3d736..9a033bade1 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.20.0 +// sqlc v1.29.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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.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 3322ce8933..c7f52ef6be 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.20.0 +// sqlc v1.29.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 819e7cef27..7c25c72337 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a6a0dc86c3..64df174a94 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.20.0 +// sqlc v1.29.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 80e0a0b14c..0505c23961 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.20.0 +// sqlc v1.29.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 f6ec96af94..4ca1dd8605 100644 --- a/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql +++ b/internal/endtoend/testdata/overrides_result_tag/stdlib/query.sql @@ -1,13 +1,3 @@ -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.*, @@ -17,4 +7,4 @@ FROM accounts a INNER JOIN users_accounts ua ON a.id = ua.id2 WHERE - a.id = @account_id; \ No newline at end of file + a.id = @account_id; 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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 cd58070798..9e2566e970 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.20.0 +// sqlc v1.29.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 27da41ab0a..b6c94cbe6a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 eaca34a5a9..f3fb0be8e0 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.20.0 +// sqlc v1.29.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 f05ce6a72c..341e818850 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 eaca34a5a9..f3fb0be8e0 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.20.0 +// sqlc v1.29.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 88b7e07160..446b7c7bf4 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..fbffbfdf87 --- /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.29.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..684f3541bc --- /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.29.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..0c56c2b4e8 --- /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.29.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..c19b9af15f --- /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.29.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..c76de41d7d --- /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.29.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..0c56c2b4e8 --- /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.29.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..a6063aa87b --- /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.29.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..1fe3ec714d --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1f67f50bb3..64336a3055 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.20.0 +// sqlc v1.29.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 ea46901a84..b8c383c547 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 851d0d3fb3..4e45cb56f9 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.20.0 +// sqlc v1.29.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 05c1ef0303..d26e99a2b0 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 168c0cbaac..1a1e21b18e 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.20.0 +// sqlc v1.29.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 f4c60e7092..9f6bec86d7 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1f67f50bb3..64336a3055 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.20.0 +// sqlc v1.29.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 f2e424e524..e7e651a7ad 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 37b508dccb..c22b0f9ced 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.20.0 +// sqlc v1.29.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 94ca0523e9..e6ef6508e1 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 37b508dccb..c22b0f9ced 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.20.0 +// sqlc v1.29.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 d895fc5029..61b1c3028a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 65ff3aa47d..9d3d129800 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 7be059e263..6b53a8500d 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 db5fe749f6..0fdfbd23af 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.20.0 +// sqlc v1.29.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 bceb727e92..4a8edcd277 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 4d8c8f9f0e..883dd9b3e8 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 635378fe82..aa9d0b252f 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.20.0 +// sqlc v1.29.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 ea9b4e6c0e..7519e4114f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 132c45190e..926648e5a8 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.20.0 +// sqlc v1.29.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 a46130eaa1..521edd9dfb 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 132c45190e..926648e5a8 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.20.0 +// sqlc v1.29.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 145e29cd79..41b74db2b2 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e242874c52..6d2dcc4a1c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 2764801cd3..523135f86a 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e242874c52..6d2dcc4a1c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 5c69566143..c23a161091 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 44204918e8..91559db40a 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 789dc9e6e3..418b6fc45b 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.0 package db diff --git a/internal/endtoend/testdata/pg_dump/db/models.go b/internal/endtoend/testdata/pg_dump/db/models.go index 825184c6da..601f8ed004 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.20.0 +// sqlc v1.29.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 176480aa60..75c8c8ef6a 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 6dfeb6e1ce..dffd4cde8c 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.20.0 +// sqlc v1.29.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..8d665d9985 --- /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.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 fd6049e0f3..25d7a8199f 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.20.0 +// sqlc v1.29.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..8d665d9985 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6dfeb6e1ce..dffd4cde8c 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.20.0 +// sqlc v1.29.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..54fd0c340e --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 2fc0ab9c15..976e3cda74 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.20.0 +// sqlc v1.29.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 e8aec01bc4..a3f74a91d1 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.20.0 +// sqlc v1.29.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 61884130c1..5b93976877 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 2fc0ab9c15..976e3cda74 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.20.0 +// sqlc v1.29.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 e8aec01bc4..a3f74a91d1 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.20.0 +// sqlc v1.29.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 e273222a85..74293388e8 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 cf4f959c24..d894170109 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.20.0 +// sqlc v1.29.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 aefea2e119..f07fde7eea 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.20.0 +// sqlc v1.29.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 d57a8a3afc..23dce40e33 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 b3eba2dc33..69df42eed8 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 166ca9bf3b..3e98b23ce0 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 e867b0d4a6..5895a14a59 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 6ca9962050..1a22d2cd4e 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 a025f6ef3f..f8a8c125db 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 284196e814..369a182dae 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 ba8dda8529..7c1301ce7c 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 ba8dda8529..7c1301ce7c 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 cd3007335d..210882cd84 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.20.0 +// sqlc v1.29.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 98464ad3b1..f95c7eb71f 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..958ec99717 --- /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.29.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..c5a1db8a21 --- /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.29.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 552cf4553d..998accfb8f 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.20.0 +// sqlc v1.29.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 da198bedc5..e03befd21f 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.20.0 +// sqlc v1.29.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 686053afad..d2201946d2 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.20.0 +// sqlc v1.29.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 448766bdaa..814523221a 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.20.0 +// sqlc v1.29.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 1bcb72f7a6..ac7d306b14 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.20.0 +// sqlc v1.29.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 c0e7b1b7a8..7af9c2489f 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.20.0 +// sqlc v1.29.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 f05c873d46..5a3009abc4 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.20.0 +// sqlc v1.29.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 46200b48dc..3b857567b4 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.20.0 +// sqlc v1.29.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 a06ad94f50..14b229e3b5 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.20.0 +// sqlc v1.29.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 f05c873d46..5a3009abc4 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.20.0 +// sqlc v1.29.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 0a8538b8b5..72e2b95b75 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.20.0 +// sqlc v1.29.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 8015cc0646..10199126f6 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.20.0 +// sqlc v1.29.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 ccf361cc55..6602b01ca6 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.20.0 +// sqlc v1.29.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 36c7d5619f..ab24622889 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.20.0 +// sqlc v1.29.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 25ada1e7fe..66e41acc75 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.20.0 +// sqlc v1.29.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 a75e929810..bd1a278413 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.20.0 +// sqlc v1.29.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 41539b0e7b..7c9f363392 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.20.0 +// sqlc v1.29.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 25ada1e7fe..66e41acc75 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.20.0 +// sqlc v1.29.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 f43ee8c724..e516fbcc7c 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.20.0 +// sqlc v1.29.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 36c7d5619f..ab24622889 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.20.0 +// sqlc v1.29.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 f7c7815f27..50369ba439 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.20.0 +// sqlc v1.29.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 5751608e13..b7563e0f2c 100644 --- a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json @@ -34,6 +34,7 @@ "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, @@ -42,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": "", @@ -65396,6 +65398,6 @@ "insert_into_table": null } ], - "sqlc_version": "v1.20.0", + "sqlc_version": "v1.29.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..2e996ca79d 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,3 @@ { - "process": "sqlc-gen-json" + "contexts": ["base"] } 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 5751608e13..4ec61a3308 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,46 +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_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": { @@ -65396,6 +65365,7 @@ "insert_into_table": null } ], - "sqlc_version": "v1.20.0", - "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" + "sqlc_version": "v1.29.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 new file mode 100644 index 0000000000..1aa4920cb9 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/exec.json @@ -0,0 +1,4 @@ +{ + "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 new file mode 100644 index 0000000000..8c776c74b9 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/gen/env.json @@ -0,0 +1,6 @@ +{ + "env": [ + "SQLC_VERSION=v1.29.0", + "SQLC_DUMMY_VALUE=true" + ] +} diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_test/query.sql b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/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_sqlc_gen_test/schema.sql b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/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_sqlc_gen_test/sqlc.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/sqlc.json new file mode 100644 index 0000000000..a2b0e8b931 --- /dev/null +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_test/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", + "env": ["SQLC_DUMMY_VALUE"], + "process": { + "cmd": "sqlc-gen-test" + } + } + ] +} 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 b4d5414225..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.20.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 b528c20a64..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.20.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 b4d5414225..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.20.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 888c285404..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.20.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 736cb1352d..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.20.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 d28f21159a..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.20.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 new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/query_parameter_limit_param_only/postgresql/go/models.go b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go new file mode 100644 index 0000000000..76fc1befc3 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/models.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "database/sql" + "time" +) + +type Notice struct { + ID int32 + Cnt int32 + Status string + NoticeAt sql.NullTime + CreatedAt time.Time +} 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 new file mode 100644 index 0000000000..f470f002a4 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +type Querier interface { + CreateNotice(ctx context.Context, cnt int32, createdAt time.Time) error + MarkNoticeDone(ctx context.Context, noticeAt sql.NullTime, iD int32) error +} + +var _ Querier = (*Queries)(nil) 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 new file mode 100644 index 0000000000..729f30632e --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/go/query.sql.go @@ -0,0 +1,33 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" + "time" +) + +const createNotice = `-- name: CreateNotice :exec +INSERT INTO notice (cnt, created_at) +VALUES ($1, $2) +` + +func (q *Queries) CreateNotice(ctx context.Context, cnt int32, createdAt time.Time) error { + _, err := q.db.ExecContext(ctx, createNotice, cnt, createdAt) + return err +} + +const markNoticeDone = `-- name: MarkNoticeDone :exec +UPDATE notice +SET status='done', notice_at=$1 +WHERE id=$2 +` + +func (q *Queries) MarkNoticeDone(ctx context.Context, noticeAt sql.NullTime, iD int32) error { + _, err := q.db.ExecContext(ctx, markNoticeDone, noticeAt, iD) + return err +} 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 new file mode 100644 index 0000000000..7622bafa13 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/query.sql @@ -0,0 +1,8 @@ +-- name: MarkNoticeDone :exec +UPDATE notice +SET status='done', notice_at=$1 +WHERE id=$2; + +-- name: CreateNotice :exec +INSERT INTO notice (cnt, created_at) +VALUES ($1, $2); \ No newline at end of file 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 new file mode 100644 index 0000000000..78d96c3e80 --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_param_only/postgresql/sqlc.json @@ -0,0 +1,14 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "schema": "schema.sql", + "queries": "query.sql", + "query_parameter_limit": 2, + "emit_interface": true, + "name": "querytest" + } + ] +} \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 7fbbf5fbc7..c8c68f2aa2 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.20.0 +// sqlc v1.29.0 package querytest @@ -15,3 +15,8 @@ type Author struct { CountryCode string Titles []string } + +type Client struct { + ID int32 + Name string +} 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 867290c049..13553b2347 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -13,6 +13,22 @@ import ( "github.com/lib/pq" ) +const addNewClient = `-- name: AddNewClient :one +INSERT INTO clients ( + id, name +) VALUES ( + $1, $2 +) +RETURNING id, name +` + +func (q *Queries) AddNewClient(ctx context.Context, iD int32, name string) (Client, error) { + row := q.db.QueryRowContext(ctx, addNewClient, iD, name) + var i Client + err := row.Scan(&i.ID, &i.Name) + return i, err +} + const createAuthor = `-- name: CreateAuthor :one INSERT INTO authors ( name, bio, country_code, titles 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 8edd6ae9b9..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; @@ -33,3 +24,11 @@ WHERE id IN (sqlc.slice(ids)) AND name = $1; -- name: CreateAuthorOnlyTitles :one INSERT INTO authors (name, titles) VALUES ($1, $2) RETURNING *; + +-- name: AddNewClient :one +INSERT INTO clients ( + id, name +) VALUES ( + $1, $2 +) +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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f68b84d6e2..f6450b2b81 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..ddfce299ef --- /dev/null +++ b/internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go @@ -0,0 +1,18 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "context" +) + +type Querier interface { + CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) + DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error + GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, error) + ListAuthors(ctx context.Context) ([]Author, error) +} + +var _ Querier = (*Queries)(nil) 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 12511a4135..7570c6340f 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.20.0 +// sqlc v1.29.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 dd45084b04..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,10 +5,11 @@ "path": "go", "engine": "postgresql", "name": "querytest", - "schema": "query.sql", + "schema": "schema.sql", "queries": "query.sql", - "query_parameter_limit": 0 + "query_parameter_limit": 0, + "emit_interface": true } ] } - \ No newline at end of file + diff --git a/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_colname/sqlite/go/models.go b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go new file mode 100644 index 0000000000..8280cd5a64 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +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 new file mode 100644 index 0000000000..06a1f36544 --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const testList = `-- name: TestList :many +SELECT id FROM "test" +` + +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_colname/sqlite/query.sql b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql new file mode 100644 index 0000000000..8b8ae15e9a --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/sqlite/query.sql @@ -0,0 +1,2 @@ +-- 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 new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/quoted_colname/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/quoted_tablename/sqlite/go/db.go b/internal/endtoend/testdata/quoted_tablename/sqlite/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /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.29.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..5a32e08822 --- /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.29.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..c8c17c306a --- /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.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 7f3d1f1d7b..6333dbd03a 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.20.0 +// sqlc v1.29.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 0b1da6b617..745742058c 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 b92c17132c..359bf88b93 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.20.0 +// sqlc v1.29.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 e50f750ece..81036f9d88 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.20.0 +// sqlc v1.29.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 4d8ec80dfb..d1244c9e7a 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v4/sqlc.json @@ -6,8 +6,8 @@ "engine": "postgresql", "sql_package": "pgx/v4", "name": "querytest", - "schema": "query.sql", - "queries": "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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 b92c17132c..359bf88b93 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.20.0 +// sqlc v1.29.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 e50f750ece..81036f9d88 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.20.0 +// sqlc v1.29.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 f7344cf1ba..32ede07158 100644 --- a/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json +++ b/internal/endtoend/testdata/refreshmatview/postgresql/pgx/v5/sqlc.json @@ -6,8 +6,8 @@ "engine": "postgresql", "sql_package": "pgx/v5", "name": "querytest", - "schema": "query.sql", - "queries": "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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 8f3b4966fe..53209f1df9 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.20.0 +// sqlc v1.29.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 f89822ad6a..2ebdf5dc20 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 8f3b4966fe..53209f1df9 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.20.0 +// sqlc v1.29.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 f89822ad6a..2ebdf5dc20 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8f3b4966fe..53209f1df9 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.20.0 +// sqlc v1.29.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 42e378a276..6ddaaffc86 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 8f3b4966fe..53209f1df9 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.20.0 +// sqlc v1.29.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 f89822ad6a..2ebdf5dc20 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 8f3b4966fe..53209f1df9 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.20.0 +// sqlc v1.29.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 f89822ad6a..2ebdf5dc20 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8f3b4966fe..53209f1df9 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.20.0 +// sqlc v1.29.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 42e378a276..6ddaaffc86 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.20.0 +// sqlc v1.29.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 38190bc1de..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": { @@ -19,5 +19,5 @@ } } } - ], + ] } 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 702e3102c8..99fb06239a 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.20.0 +// sqlc v1.29.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 7ec932e1a8..2a384b52fa 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 face959890..0539d15fe6 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.20.0 +// sqlc v1.29.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 4df8997edf..b033435375 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 702e3102c8..99fb06239a 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.20.0 +// sqlc v1.29.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 ccb60ceade..32f5ec727b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/returning/sqlite/go/models.go b/internal/endtoend/testdata/returning/sqlite/go/models.go index 120f6386a7..7664a57d7e 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.20.0 +// sqlc v1.29.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 1f4dadd71c..5145eba78a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2ba84d7ad1..33f73d9e28 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.20.0 +// sqlc v1.29.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 393f157505..d172d4f480 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 91072d77a2..a5594a8ef8 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.20.0 +// sqlc v1.29.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 e0d9f29aa9..2142276375 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 91072d77a2..a5594a8ef8 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.20.0 +// sqlc v1.29.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 e0d9f29aa9..2142276375 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 91072d77a2..a5594a8ef8 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.20.0 +// sqlc v1.29.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 e122153f44..1f454b9b85 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 52bf230ce6..12a0f28424 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.20.0 +// sqlc v1.29.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 d1e7d92a2b..3ac0842b9a 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 7f89dff73a..214db96634 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 7f89dff73a..214db96634 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 18bf9514c8..d56cc80b60 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 936a8d19fc..00e016a5c0 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.20.0 +// sqlc v1.29.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 65da80f113..9f43c9af4d 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 936a8d19fc..00e016a5c0 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.20.0 +// sqlc v1.29.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 65da80f113..9f43c9af4d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 936a8d19fc..00e016a5c0 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.20.0 +// sqlc v1.29.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 a8f8d4c903..698da3636b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 52bf230ce6..12a0f28424 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.20.0 +// sqlc v1.29.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 bdda3a16f2..35a9bca8c8 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 c9d167432f..eadf0cfbc5 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 c9d167432f..eadf0cfbc5 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 ef2377e650..276e05f279 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 52bf230ce6..12a0f28424 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.20.0 +// sqlc v1.29.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 7b26fd358b..de7b366f5f 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]uint64, error) { + rows, err := q.db.QueryContext(ctx, schemaScopedColList) + if err != nil { + return nil, err + } + defer rows.Close() + var items []uint64 + for rows.Next() { + var id uint64 + 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 schemaScopedList = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` diff --git a/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql b/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql index cb8d6cdb61..66dab6bfe7 100644 --- a/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql +++ b/internal/endtoend/testdata/schema_scoped_list/mysql/query.sql @@ -1,5 +1,5 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 1e0f26b3e1..ae13c31e35 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,30 @@ import ( "context" ) +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedColList) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + const schemaScopedList = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` 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 cb8d6cdb61..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,5 +1,5 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 1e0f26b3e1..ae13c31e35 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,30 @@ import ( "context" ) +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, schemaScopedColList) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} + const schemaScopedList = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` 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 cb8d6cdb61..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,5 +1,5 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 a3b6a9af3d..bb707c1f50 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.20.0 +// sqlc v1.29.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 07a890b45e..2d285c0884 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -9,6 +9,33 @@ import ( "context" ) +const schemaScopedColList = `-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar +` + +func (q *Queries) SchemaScopedColList(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, schemaScopedColList) + 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 schemaScopedList = `-- name: SchemaScopedList :many SELECT id FROM foo.bar ` 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 cb8d6cdb61..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,5 +1,5 @@ -CREATE SCHEMA foo; -CREATE TABLE foo.bar (id serial not null); - -- name: SchemaScopedList :many SELECT * FROM foo.bar; + +-- name: SchemaScopedColList :many +SELECT foo.bar.id FROM foo.bar; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2ba84d7ad1..33f73d9e28 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.20.0 +// sqlc v1.29.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 f3cc18129a..0bb056b60b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 91072d77a2..a5594a8ef8 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.20.0 +// sqlc v1.29.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 14c9836ab7..2fb4074d57 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 91072d77a2..a5594a8ef8 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.20.0 +// sqlc v1.29.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 14c9836ab7..2fb4074d57 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 91072d77a2..a5594a8ef8 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.20.0 +// sqlc v1.29.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 6b1721d32c..2c8d31703c 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..54b5fbce8e --- /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.29.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..301e6b975f --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 61a5ede796..459eece160 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.20.0 +// sqlc v1.29.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 f77ecb5305..204fbbe976 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.20.0 +// sqlc v1.29.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/pgx/v4/go/db.go b/internal/endtoend/testdata/select_column_cast/pgx/v4/go/db.go deleted file mode 100644 index f0ea7fd21a..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v4/go/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.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/select_column_cast/pgx/v4/go/models.go b/internal/endtoend/testdata/select_column_cast/pgx/v4/go/models.go deleted file mode 100644 index 61a5ede796..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v4/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 - -package querytest - -import () - -type Foo struct { - Bar bool -} diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/pgx/v4/go/query.sql.go deleted file mode 100644 index f73e11a30d..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v4/go/query.sql.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 -// source: query.sql - -package querytest - -import ( - "context" -) - -const selectColumnCast = `-- name: SelectColumnCast :many -SELECT bar::int FROM foo -` - -func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, selectColumnCast) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var bar int32 - if err := rows.Scan(&bar); err != nil { - return nil, err - } - items = append(items, bar) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v4/query.sql b/internal/endtoend/testdata/select_column_cast/pgx/v4/query.sql deleted file mode 100644 index 412fe6b77b..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v4/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null); - --- name: SelectColumnCast :many -SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v4/sqlc.json b/internal/endtoend/testdata/select_column_cast/pgx/v4/sqlc.json deleted file mode 100644 index 9403bd0279..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v4/sqlc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "sql_package": "pgx/v4", - "name": "querytest", - "schema": "query.sql", - "queries": "query.sql" - } - ] -} diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v5/go/db.go b/internal/endtoend/testdata/select_column_cast/pgx/v5/go/db.go deleted file mode 100644 index e715a0f400..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v5/go/db.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.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_column_cast/pgx/v5/go/models.go b/internal/endtoend/testdata/select_column_cast/pgx/v5/go/models.go deleted file mode 100644 index 61a5ede796..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v5/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 - -package querytest - -import () - -type Foo struct { - Bar bool -} diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/pgx/v5/go/query.sql.go deleted file mode 100644 index f73e11a30d..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v5/go/query.sql.go +++ /dev/null @@ -1,34 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 -// source: query.sql - -package querytest - -import ( - "context" -) - -const selectColumnCast = `-- name: SelectColumnCast :many -SELECT bar::int FROM foo -` - -func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.Query(ctx, selectColumnCast) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var bar int32 - if err := rows.Scan(&bar); err != nil { - return nil, err - } - items = append(items, bar) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v5/query.sql b/internal/endtoend/testdata/select_column_cast/pgx/v5/query.sql deleted file mode 100644 index 412fe6b77b..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v5/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null); - --- name: SelectColumnCast :many -SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/pgx/v5/sqlc.json b/internal/endtoend/testdata/select_column_cast/pgx/v5/sqlc.json deleted file mode 100644 index 6645ccbd1b..0000000000 --- a/internal/endtoend/testdata/select_column_cast/pgx/v5/sqlc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1", - "packages": [ - { - "path": "go", - "engine": "postgresql", - "sql_package": "pgx/v5", - "name": "querytest", - "schema": "query.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 new file mode 100644 index 0000000000..635cce3c5d --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/select_column_cast/postgresql/pgx/v4/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go new file mode 100644 index 0000000000..459eece160 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +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 new file mode 100644 index 0000000000..256218cafb --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT bar::int FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var bar int32 + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} 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 new file mode 100644 index 0000000000..bbb1b9a863 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/query.sql @@ -0,0 +1,2 @@ +-- 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 new file mode 100644 index 0000000000..d1244c9e7a --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v4/sqlc.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "packages": [ + { + "path": "go", + "engine": "postgresql", + "sql_package": "pgx/v4", + "name": "querytest", + "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 new file mode 100644 index 0000000000..e83d6a948c --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_column_cast/postgresql/pgx/v5/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go new file mode 100644 index 0000000000..459eece160 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +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 new file mode 100644 index 0000000000..256218cafb --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/go/query.sql.go @@ -0,0 +1,34 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT bar::int FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var bar int32 + if err := rows.Scan(&bar); err != nil { + return nil, err + } + items = append(items, bar) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} 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 new file mode 100644 index 0000000000..bbb1b9a863 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/pgx/v5/query.sql @@ -0,0 +1,2 @@ +-- 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 new file mode 100644 index 0000000000..32ede07158 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/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/select_column_cast/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_column_cast/postgresql/stdlib/go/models.go b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go new file mode 100644 index 0000000000..459eece160 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +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 new file mode 100644 index 0000000000..d9724cb884 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT bar::int FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var bar int32 + 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/select_column_cast/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql new file mode 100644 index 0000000000..bbb1b9a863 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/query.sql @@ -0,0 +1,2 @@ +-- 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 new file mode 100644 index 0000000000..dbe55e66a6 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/postgresql/stdlib/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/select_column_cast/sqlite/go/db.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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_column_cast/sqlite/go/models.go b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go new file mode 100644 index 0000000000..2e4ab15ca4 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/models.go @@ -0,0 +1,9 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +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 new file mode 100644 index 0000000000..20d6f2ab72 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/go/query.sql.go @@ -0,0 +1,37 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectColumnCast = `-- name: SelectColumnCast :many +SELECT CAST(bar AS BLOB) FROM foo +` + +func (q *Queries) SelectColumnCast(ctx context.Context) ([][]byte, error) { + rows, err := q.db.QueryContext(ctx, selectColumnCast) + if err != nil { + return nil, err + } + defer rows.Close() + var items [][]byte + for rows.Next() { + var bar []byte + 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/select_column_cast/sqlite/query.sql b/internal/endtoend/testdata/select_column_cast/sqlite/query.sql new file mode 100644 index 0000000000..4775543757 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/sqlite/query.sql @@ -0,0 +1,2 @@ +-- 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 new file mode 100644 index 0000000000..95b9cd09c0 --- /dev/null +++ b/internal/endtoend/testdata/select_column_cast/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/select_column_cast/stdlib/go/db.go b/internal/endtoend/testdata/select_column_cast/stdlib/go/db.go deleted file mode 100644 index 57406b68e8..0000000000 --- a/internal/endtoend/testdata/select_column_cast/stdlib/go/db.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.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_column_cast/stdlib/go/models.go b/internal/endtoend/testdata/select_column_cast/stdlib/go/models.go deleted file mode 100644 index 61a5ede796..0000000000 --- a/internal/endtoend/testdata/select_column_cast/stdlib/go/models.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 - -package querytest - -import () - -type Foo struct { - Bar bool -} diff --git a/internal/endtoend/testdata/select_column_cast/stdlib/go/query.sql.go b/internal/endtoend/testdata/select_column_cast/stdlib/go/query.sql.go deleted file mode 100644 index feb7d76714..0000000000 --- a/internal/endtoend/testdata/select_column_cast/stdlib/go/query.sql.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.20.0 -// source: query.sql - -package querytest - -import ( - "context" -) - -const selectColumnCast = `-- name: SelectColumnCast :many -SELECT bar::int FROM foo -` - -func (q *Queries) SelectColumnCast(ctx context.Context) ([]int32, error) { - rows, err := q.db.QueryContext(ctx, selectColumnCast) - if err != nil { - return nil, err - } - defer rows.Close() - var items []int32 - for rows.Next() { - var bar int32 - 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/select_column_cast/stdlib/query.sql b/internal/endtoend/testdata/select_column_cast/stdlib/query.sql deleted file mode 100644 index 412fe6b77b..0000000000 --- a/internal/endtoend/testdata/select_column_cast/stdlib/query.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE foo (bar bool not null); - --- name: SelectColumnCast :many -SELECT bar::int FROM foo; diff --git a/internal/endtoend/testdata/select_column_cast/stdlib/sqlc.json b/internal/endtoend/testdata/select_column_cast/stdlib/sqlc.json deleted file mode 100644 index ac7c2ed829..0000000000 --- a/internal/endtoend/testdata/select_column_cast/stdlib/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/select_cte/sqlite/go/db.go b/internal/endtoend/testdata/select_cte/sqlite/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 f98c6de9f9..1d24f26310 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d6383bfebb..19549f12ca 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.20.0 +// sqlc v1.29.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 9d233e2bd8..a104a0cd2c 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 f1d82d7f35..435562ad17 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.20.0 +// sqlc v1.29.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 9d233e2bd8..a104a0cd2c 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d6383bfebb..19549f12ca 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.20.0 +// sqlc v1.29.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 8c419c6abd..2e2fd3af2e 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d6383bfebb..19549f12ca 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.20.0 +// sqlc v1.29.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 56927243fc..8566115351 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 f1d82d7f35..435562ad17 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.20.0 +// sqlc v1.29.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 56927243fc..8566115351 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d6383bfebb..19549f12ca 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.20.0 +// sqlc v1.29.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 8e399107cb..2cbce0317c 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 455d253d70..8c157cb7ef 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 455d253d70..8c157cb7ef 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 ba2143a230..8eb12f4f1f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 aaed19bea3..2506b23631 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3b610b1747..c0ec06ce2e 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.20.0 +// sqlc v1.29.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 7bbec35ef5..2805ef1206 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3ed122bde8..69dbf9ba40 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.20.0 +// sqlc v1.29.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 3d7579d7b6..554e0c3b5b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 3ed122bde8..69dbf9ba40 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.20.0 +// sqlc v1.29.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 253608bb5d..766ca624d2 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 763a5d37b3..d646dea864 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.20.0 +// sqlc v1.29.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 fd19ffc9a4..cf1efe4fd7 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3ed122bde8..69dbf9ba40 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.20.0 +// sqlc v1.29.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 b3c67bfbe9..294ec34479 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3ed122bde8..69dbf9ba40 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.20.0 +// sqlc v1.29.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 ccd6e7430d..8b6a3342f3 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6b1804def3..1c45f7a24b 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.20.0 +// sqlc v1.29.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 d7989c6d18..2eaff0920b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6b1804def3..1c45f7a24b 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.20.0 +// sqlc v1.29.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 d7989c6d18..2eaff0920b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6b1804def3..1c45f7a24b 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.20.0 +// sqlc v1.29.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 d7989c6d18..2eaff0920b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 41b9ef08b3..388d529ae8 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 41b9ef08b3..388d529ae8 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 827e34f59b..ca42773ba2 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.20.0 +// sqlc v1.29.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 6efd7aa374..ae5e6c7cc1 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 a488ee74cf..8e3d2ee03b 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..c157a76881 --- /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.29.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..5c6de30c01 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4cadd3e229..91e3b8faa3 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..341ed607c1 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -40,3 +40,30 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, getIDAll) + 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/select_star/mysql/query.sql b/internal/endtoend/testdata/select_star/mysql/query.sql index e2f85e2a9a..4c230627d0 100644 --- a/internal/endtoend/testdata/select_star/mysql/query.sql +++ b/internal/endtoend/testdata/select_star/mysql/query.sql @@ -1,2 +1,5 @@ /* name: GetAll :many */ SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 4cadd3e229..91e3b8faa3 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.20.0 +// sqlc v1.29.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 3fba9882e7..1382d79b9e 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -37,3 +37,27 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, getIDAll) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql index 237b20193b..0952880cac 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v4/query.sql @@ -1,2 +1,5 @@ -- name: GetAll :many SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 dbe86a6bee..d41e7ef9af 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.20.0 +// sqlc v1.29.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 3fba9882e7..1382d79b9e 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -37,3 +37,27 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, getIDAll) + 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.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql index 237b20193b..0952880cac 100644 --- a/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_star/postgresql/pgx/v5/query.sql @@ -1,2 +1,5 @@ -- name: GetAll :many SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 4cadd3e229..91e3b8faa3 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..341ed607c1 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -40,3 +40,30 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, getIDAll) + 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/select_star/postgresql/stdlib/query.sql b/internal/endtoend/testdata/select_star/postgresql/stdlib/query.sql index 237b20193b..0952880cac 100644 --- a/internal/endtoend/testdata/select_star/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/select_star/postgresql/stdlib/query.sql @@ -1,2 +1,5 @@ -- name: GetAll :many SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file diff --git a/internal/endtoend/testdata/select_star/sqlite/go/db.go b/internal/endtoend/testdata/select_star/sqlite/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 b9a3d31b17..dc6b7b6676 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.20.0 +// sqlc v1.29.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 c0b9e46bdd..49742884e6 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -40,3 +40,30 @@ func (q *Queries) GetAll(ctx context.Context) ([]User, error) { } return items, nil } + +const getIDAll = `-- name: GetIDAll :many +SELECT id FROM (SELECT id FROM users) t +` + +func (q *Queries) GetIDAll(ctx context.Context) ([]int64, error) { + rows, err := q.db.QueryContext(ctx, getIDAll) + 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.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_star/sqlite/query.sql b/internal/endtoend/testdata/select_star/sqlite/query.sql index 237b20193b..0952880cac 100644 --- a/internal/endtoend/testdata/select_star/sqlite/query.sql +++ b/internal/endtoend/testdata/select_star/sqlite/query.sql @@ -1,2 +1,5 @@ -- name: GetAll :many SELECT * FROM users; + +/* name: GetIDAll :many */ +SELECT * FROM (SELECT id FROM users) t; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d2e1932835..19959dd0a8 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.20.0 +// sqlc v1.29.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 9fb6c21f14..2b28bcc163 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 cddf5d7c01..d9d7dc0087 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.20.0 +// sqlc v1.29.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 af0884c81a..a056808ba5 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 63ba7fff04..45a1b664e2 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.20.0 +// sqlc v1.29.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 d4a0a6e186..10590d638d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 cddf5d7c01..d9d7dc0087 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.20.0 +// sqlc v1.29.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 714926300d..47769cbc0c 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..ea697f12b9 --- /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.29.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..56d65ab88a --- /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.29.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..e83d6a948c --- /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.29.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..6d490c4e74 --- /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.29.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..9147766311 --- /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.29.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_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..e83d6a948c --- /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.29.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..9a2bab52bb --- /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.29.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..1b9253517a --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 c7b4984a64..c845ab3ff9 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 c7b4984a64..c845ab3ff9 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 6929f8a414..cf5751e53d 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..aa9d0b252f 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,11 @@ import ( "database/sql" ) +type Bar struct { + A sql.NullString + B sql.NullString +} + type Foo struct { A sql.NullString B sql.NullString 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 96147809a8..011ef8eb07 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -95,3 +95,67 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { } return items, nil } + +const selectUnionOther = `-- name: SelectUnionOther :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT ? OFFSET ? +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/mysql/query.sql b/internal/endtoend/testdata/select_union/mysql/query.sql index 80dd8cc4f2..d607aa7222 100644 --- a/internal/endtoend/testdata/select_union/mysql/query.sql +++ b/internal/endtoend/testdata/select_union/mysql/query.sql @@ -1,10 +1,14 @@ -CREATE TABLE foo (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION SELECT * FROM foo; +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT ? OFFSET ?; + -- name: SelectExcept :many SELECT * FROM foo EXCEPT @@ -14,3 +18,8 @@ SELECT * FROM foo; SELECT * FROM foo INTERSECT SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; \ No newline at end of file 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 c0cab4c642..aa9d0b252f 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,11 @@ import ( "database/sql" ) +type Bar struct { + A sql.NullString + B sql.NullString +} + type Foo struct { A sql.NullString B sql.NullString 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 d2cfd2e0df..9380106f0c 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -86,3 +86,61 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { } return items, nil } + +const selectUnionOther = `-- name: SelectUnionOther :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT $1 OFFSET $2 +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} 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 80dd8cc4f2..107aee02d2 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v4/query.sql @@ -1,10 +1,14 @@ -CREATE TABLE foo (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION SELECT * FROM foo; +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT $1 OFFSET $2; + -- name: SelectExcept :many SELECT * FROM foo EXCEPT @@ -14,3 +18,8 @@ SELECT * FROM foo; SELECT * FROM foo INTERSECT SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 db5fe749f6..219e38bdc3 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,11 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +type Bar struct { + A pgtype.Text + B pgtype.Text +} + type Foo struct { A pgtype.Text B pgtype.Text 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 d2cfd2e0df..9380106f0c 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -86,3 +86,61 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { } return items, nil } + +const selectUnionOther = `-- name: SelectUnionOther :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT $1 OFFSET $2 +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.Query(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} 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 80dd8cc4f2..107aee02d2 100644 --- a/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/pgx/v5/query.sql @@ -1,10 +1,14 @@ -CREATE TABLE foo (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION SELECT * FROM foo; +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT $1 OFFSET $2; + -- name: SelectExcept :many SELECT * FROM foo EXCEPT @@ -14,3 +18,8 @@ SELECT * FROM foo; SELECT * FROM foo INTERSECT SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..aa9d0b252f 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.20.0 +// sqlc v1.29.0 package querytest @@ -8,6 +8,11 @@ import ( "database/sql" ) +type Bar struct { + A sql.NullString + B sql.NullString +} + type Foo struct { A sql.NullString B sql.NullString 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 96147809a8..ebc0fbb363 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -95,3 +95,67 @@ func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { } return items, nil } + +const selectUnionOther = `-- name: SelectUnionOther :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT $1 OFFSET $2 +` + +type SelectUnionWithLimitParams struct { + Limit int32 + Offset int32 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql index 80dd8cc4f2..107aee02d2 100644 --- a/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql +++ b/internal/endtoend/testdata/select_union/postgres/stdlib/query.sql @@ -1,10 +1,14 @@ -CREATE TABLE foo (a text, b text); - -- name: SelectUnion :many SELECT * FROM foo UNION SELECT * FROM foo; +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT $1 OFFSET $2; + -- name: SelectExcept :many SELECT * FROM foo EXCEPT @@ -14,3 +18,8 @@ SELECT * FROM foo; SELECT * FROM foo INTERSECT SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; \ No newline at end of file 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 new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/sqlite/go/models.go b/internal/endtoend/testdata/select_union/sqlite/go/models.go new file mode 100644 index 0000000000..aa9d0b252f --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/go/models.go @@ -0,0 +1,19 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "database/sql" +) + +type Bar struct { + A sql.NullString + B sql.NullString +} + +type Foo struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6586b036f5 --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/go/query.sql.go @@ -0,0 +1,161 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const selectExcept = `-- name: SelectExcept :many +SELECT a, b FROM foo +EXCEPT +SELECT a, b FROM foo +` + +func (q *Queries) SelectExcept(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectExcept) + 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 selectIntersect = `-- name: SelectIntersect :many +SELECT a, b FROM foo +INTERSECT +SELECT a, b FROM foo +` + +func (q *Queries) SelectIntersect(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectIntersect) + 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 selectUnion = `-- name: SelectUnion :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +` + +func (q *Queries) SelectUnion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnion) + 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 +SELECT a, b FROM bar +` + +func (q *Queries) SelectUnionOther(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionOther) + 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 selectUnionWithLimit = `-- name: SelectUnionWithLimit :many +SELECT a, b FROM foo +UNION +SELECT a, b FROM foo +LIMIT ? OFFSET ? +` + +type SelectUnionWithLimitParams struct { + Limit int64 + Offset int64 +} + +func (q *Queries) SelectUnionWithLimit(ctx context.Context, arg SelectUnionWithLimitParams) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, selectUnionWithLimit, arg.Limit, arg.Offset) + 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 +} diff --git a/internal/endtoend/testdata/select_union/sqlite/query.sql b/internal/endtoend/testdata/select_union/sqlite/query.sql new file mode 100644 index 0000000000..d607aa7222 --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/query.sql @@ -0,0 +1,25 @@ +-- name: SelectUnion :many +SELECT * FROM foo +UNION +SELECT * FROM foo; + +-- name: SelectUnionWithLimit :many +SELECT * FROM foo +UNION +SELECT * FROM foo +LIMIT ? OFFSET ?; + +-- name: SelectExcept :many +SELECT * FROM foo +EXCEPT +SELECT * FROM foo; + +-- name: SelectIntersect :many +SELECT * FROM foo +INTERSECT +SELECT * FROM foo; + +-- name: SelectUnionOther :many +SELECT * FROM foo +UNION +SELECT * FROM bar; \ No newline at end of file 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 new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/select_union/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "sqlite", + "path": "go", + "name": "querytest", + "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..a92cd6e8eb --- /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.29.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..66c9c4ae3d --- /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.29.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..051cb0b62b --- /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.29.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..e83d6a948c --- /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.29.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..3b8d187838 --- /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.29.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..3c7b5ca760 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/selectstatic/mysql/go/models.go b/internal/endtoend/testdata/selectstatic/mysql/go/models.go index e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 0d9fccf4eb..28b6b0a485 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 e80f948fbc..3781c58557 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8470879edd..b0ef6cb70e 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.20.0 +// sqlc v1.29.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 121dbf1a06..59c03fafad 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 841fbdd694..4df75a40d3 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.20.0 +// sqlc v1.29.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 37e7732942..c645e26cb4 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 4cf4f14038..ce4653f55b 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.20.0 +// sqlc v1.29.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 2b7957f6bb..1c68b8f217 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 841fbdd694..4df75a40d3 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.20.0 +// sqlc v1.29.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 2f8d798d6e..2ea65c841a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 8470879edd..b0ef6cb70e 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.20.0 +// sqlc v1.29.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 121dbf1a06..59c03fafad 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 36fcd28865..a1f74b9583 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 36fcd28865..a1f74b9583 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 e57c7500db..c157a76881 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.20.0 +// sqlc v1.29.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 80f4cd03a1..c6f94eb41f 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d19cc8c9eb..206b135413 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.20.0 +// sqlc v1.29.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 82c8a1f266..f7db77ed48 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d19cc8c9eb..206b135413 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.20.0 +// sqlc v1.29.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 d412e0a001..1cdf39be7e 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 d19cc8c9eb..206b135413 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.20.0 +// sqlc v1.29.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 d412e0a001..1cdf39be7e 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d19cc8c9eb..206b135413 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.20.0 +// sqlc v1.29.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 c937ec3bdd..4542fcdc31 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d19cc8c9eb..206b135413 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.20.0 +// sqlc v1.29.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 3a43ee007b..540caf0ef8 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 49fa8e1336..7fef1e3d0c 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.20.0 +// sqlc v1.29.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 253f32f20b..a38d5d4b5e 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 1b9a0ef1f7..48f680a073 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.20.0 +// sqlc v1.29.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 38c131a478..7b80f3aba2 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 95298eb551..13937d78c4 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.20.0 +// sqlc v1.29.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 9b90a69cd3..f92f7d228b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 569c08d367..361281b242 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.20.0 +// sqlc v1.29.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 866bcda69b..47a4763d55 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d823e999c6..71af5eef74 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.20.0 +// sqlc v1.29.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 13e1ffe434..7d18b4f85b 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d823e999c6..71af5eef74 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.20.0 +// sqlc v1.29.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 485501d759..012fb997cc 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 609bf80042..bb4add2663 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.20.0 +// sqlc v1.29.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 6f18c1158d..52d436bad4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d823e999c6..71af5eef74 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.20.0 +// sqlc v1.29.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 0544b19dd1..c56600fe83 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.20.0 +// sqlc v1.29.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 8198908d17..5d3c96e857 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.20.0 +// sqlc v1.29.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 9b6d05d74c..6fdcc24979 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.20.0 +// sqlc v1.29.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 3238cc0344..97210e1084 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d823e999c6..71af5eef74 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.20.0 +// sqlc v1.29.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 eb79eddccb..fab9e2e7df 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f827677c2c..d4d8b65965 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.20.0 +// sqlc v1.29.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 179501953d..1ca1201f04 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -51,6 +51,44 @@ func (q *Queries) FuncNullable(ctx context.Context, favourites []int32) ([]sql.N return items, nil } +const funcNullableNot = `-- name: FuncNullableNot :many +SELECT bar FROM foo +WHERE id NOT IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int32) ([]sql.NullString, error) { + query := funcNullableNot + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamIdent = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ? diff --git a/internal/endtoend/testdata/sqlc_slice/mysql/query.sql b/internal/endtoend/testdata/sqlc_slice/mysql/query.sql index b50e4c3bd6..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) @@ -22,6 +20,10 @@ WHERE id IN (sqlc.slice(favourites)); SELECT bar FROM foo WHERE id IN (sqlc.slice('favourites')); +/* name: FuncNullableNot :many */ +SELECT bar FROM foo +WHERE id NOT IN (sqlc.slice('favourites')); + /* name: TypedMyStr :many */ SELECT bar FROM foo WHERE mystr IN (sqlc.slice(mystr)); 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d19cc8c9eb..19e29bfc9c 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.20.0 +// sqlc v1.29.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 d412e0a001..df84f742a5 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faeab957f1..19e29bfc9c 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.20.0 +// sqlc v1.29.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 70dbd45d07..6cbb0e1247 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d287724153..d3811ed926 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.20.0 +// sqlc v1.29.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 8c08603075..8c55ae178a 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -49,6 +49,44 @@ func (q *Queries) FuncNullable(ctx context.Context, favourites []int64) ([]sql.N return items, nil } +const funcNullableNot = `-- name: FuncNullableNot :many +SELECT bar FROM foo +WHERE id NOT IN (/*SLICE:favourites*/?) +` + +func (q *Queries) FuncNullableNot(ctx context.Context, favourites []int64) ([]sql.NullString, error) { + query := funcNullableNot + var queryParams []interface{} + if len(favourites) > 0 { + for _, v := range favourites { + queryParams = append(queryParams, v) + } + query = strings.Replace(query, "/*SLICE:favourites*/?", strings.Repeat(",?", len(favourites))[1:], 1) + } else { + query = strings.Replace(query, "/*SLICE:favourites*/?", "NULL", 1) + } + rows, err := q.db.QueryContext(ctx, query, queryParams...) + 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 funcParamIdent = `-- name: FuncParamIdent :many SELECT name FROM foo WHERE name = ?1 diff --git a/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql b/internal/endtoend/testdata/sqlc_slice/sqlite/query.sql index 3cb6c13fee..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) @@ -20,4 +18,8 @@ WHERE id IN (sqlc.slice(favourites)); /* name: FuncNullable :many */ SELECT bar FROM foo -WHERE id IN (sqlc.slice('favourites')); \ No newline at end of file +WHERE id IN (sqlc.slice('favourites')); + +/* name: FuncNullableNot :many */ +SELECT bar FROM foo +WHERE id NOT IN (sqlc.slice('favourites')); \ No newline at end of file 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 b356a362bc..a74191eb36 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.20.0 +// sqlc v1.29.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 d287724153..d3811ed926 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.20.0 +// sqlc v1.29.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 5caee9e2e0..97e6faa351 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.20.0 +// sqlc v1.29.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..0c56c2b4e8 --- /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.29.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..89e37f98bb --- /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.29.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..9fd62914db --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f746f1a0f3..06b9bd4a57 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.20.0 +// sqlc v1.29.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 288702929b..c04e329a85 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 8f8d72b09a..3d721f7364 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -52,3 +52,30 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) } return items, nil } + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo ` + "`" + `t` + "`" + ` +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + 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 +} diff --git a/internal/endtoend/testdata/star_expansion/mysql/query.sql b/internal/endtoend/testdata/star_expansion/mysql/query.sql index d330c646f3..2461d01236 100644 --- a/internal/endtoend/testdata/star_expansion/mysql/query.sql +++ b/internal/endtoend/testdata/star_expansion/mysql/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b text); - /* name: StarExpansion :many */ SELECT *, *, foo.* FROM foo; + +/* name: StarQuotedExpansion :many */ +SELECT `t`.* FROM foo `t`; 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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 904e5d6157..9dfb9dd036 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -49,3 +49,27 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) } return items, nil } + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, starQuotedExpansion) + 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 +} 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 0305062fbd..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,4 +1,5 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; \ No newline at end of file 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 db5fe749f6..0fdfbd23af 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.20.0 +// sqlc v1.29.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 56a635f890..398d554c66 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -50,3 +50,27 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) } return items, nil } + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.Query(ctx, starQuotedExpansion) + 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 +} 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 0305062fbd..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,4 +1,5 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; \ No newline at end of file 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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 8f8d72b09a..6b72975169 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest @@ -52,3 +52,30 @@ func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) } return items, nil } + +const starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + 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 +} diff --git a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql index 0305062fbd..9588332d88 100644 --- a/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql +++ b/internal/endtoend/testdata/star_expansion/postgresql/stdlib/query.sql @@ -1,4 +1,5 @@ -CREATE TABLE foo (a text, b text); - -- name: StarExpansion :many SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; \ No newline at end of file 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 new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/star_expansion/sqlite/go/models.go b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go new file mode 100644 index 0000000000..825fc25a19 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +import ( + "database/sql" +) + +type Foo struct { + A sql.NullString + B sql.NullString +} diff --git a/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go new file mode 100644 index 0000000000..6b72975169 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/go/query.sql.go @@ -0,0 +1,81 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" + "database/sql" +) + +const starExpansion = `-- name: StarExpansion :many +SELECT a, b, a, b, foo.a, foo.b FROM foo +` + +type StarExpansionRow struct { + A sql.NullString + B sql.NullString + A_2 sql.NullString + B_2 sql.NullString + A_3 sql.NullString + B_3 sql.NullString +} + +func (q *Queries) StarExpansion(ctx context.Context) ([]StarExpansionRow, error) { + rows, err := q.db.QueryContext(ctx, starExpansion) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StarExpansionRow + for rows.Next() { + var i StarExpansionRow + if err := rows.Scan( + &i.A, + &i.B, + &i.A_2, + &i.B_2, + &i.A_3, + &i.B_3, + ); 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 starQuotedExpansion = `-- name: StarQuotedExpansion :many +SELECT t.a, t.b FROM foo "t" +` + +func (q *Queries) StarQuotedExpansion(ctx context.Context) ([]Foo, error) { + rows, err := q.db.QueryContext(ctx, starQuotedExpansion) + 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 +} diff --git a/internal/endtoend/testdata/star_expansion/sqlite/query.sql b/internal/endtoend/testdata/star_expansion/sqlite/query.sql new file mode 100644 index 0000000000..6249bb48b7 --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/query.sql @@ -0,0 +1,5 @@ +-- name: StarExpansion :many +SELECT *, *, foo.* FROM foo; + +-- name: StarQuotedExpansion :many +SELECT "t".* FROM foo "t"; 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 new file mode 100644 index 0000000000..1f9d43df5d --- /dev/null +++ b/internal/endtoend/testdata/star_expansion/sqlite/sqlc.json @@ -0,0 +1,12 @@ +{ + "version": "1", + "packages": [ + { + "engine": "sqlite", + "path": "go", + "name": "querytest", + "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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 4decbd70a3..6b5d10a6e0 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 c14fb3d79a..da2af66906 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.20.0 +// sqlc v1.29.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 b201f32525..c0accff535 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 83d18ca166..5752ebc75c 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..be64c0c729 --- /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.29.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..918195e696 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 2cda2fec3f..a98ad7f5a8 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 c14fb3d79a..da2af66906 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.20.0 +// sqlc v1.29.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 ef65402af1..fcc2a1edfb 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 560a6477b5..e66778811b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 84258a4be4..a913a03fec 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 f6235f49ab..84ae762548 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 c14fb3d79a..da2af66906 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.20.0 +// sqlc v1.29.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 3a03cd2c22..9b7101f24e 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f1a189cd3c..f09ca40f42 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.20.0 +// sqlc v1.29.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 84258a4be4..a913a03fec 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6052ac7632..6994003ab3 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.20.0 +// sqlc v1.29.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 d46bccdc82..c4dba8091d 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 6052ac7632..6994003ab3 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.20.0 +// sqlc v1.29.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 57c7a89aa7..558ee93b4b 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 7406e6f40f..93d28742f5 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.20.0 +// sqlc v1.29.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 57c7a89aa7..558ee93b4b 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 6052ac7632..6994003ab3 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.20.0 +// sqlc v1.29.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 52da00883f..fc60f8a979 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..cbd63edf6f --- /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.29.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..c909473ef1 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 04779a85c3..1020ccd607 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 c71ba04528..22316ed550 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 db5fe749f6..0fdfbd23af 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.20.0 +// sqlc v1.29.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 c71ba04528..22316ed550 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 c0cab4c642..825fc25a19 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.20.0 +// sqlc v1.29.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 04779a85c3..1020ccd607 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 94ad76b2d5..b16389094c 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.20.0 +// sqlc v1.29.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 fd02167f6a..1125569f49 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 94ad76b2d5..b16389094c 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.20.0 +// sqlc v1.29.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 adc481138c..a602cf95ce 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 9aeb3170d9..70d50483cb 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.20.0 +// sqlc v1.29.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 adc481138c..a602cf95ce 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 94ad76b2d5..b16389094c 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.20.0 +// sqlc v1.29.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 fd02167f6a..1125569f49 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 db9a02b1ee..eca415266b 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.20.0 +// sqlc v1.29.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 b116e1bcf4..9de08ebafe 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..be62c63e63 --- /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.29.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..dcf2ddbe6f --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 1250ecf663..66e75fc394 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.20.0 +// sqlc v1.29.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 0cb11b72c3..271d447cd0 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 1250ecf663..613a1aefe8 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.20.0 +// sqlc v1.29.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 0cb11b72c3..693c9e57dc 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 1250ecf663..31a6743a76 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.20.0 +// sqlc v1.29.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 d90b25514a..7cd3da0645 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 652ee1fa1f..993941e164 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.20.0 +// sqlc v1.29.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 4cfd2ea94e..39b35808e7 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.20.0 +// sqlc v1.29.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/truncate/mysql/go/db.go b/internal/endtoend/testdata/truncate/mysql/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/truncate/mysql/go/models.go b/internal/endtoend/testdata/truncate/mysql/go/models.go index abf1890cf1..fc79eb7922 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.20.0 +// sqlc v1.29.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 b7f6c5250c..aa5adc4c7a 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 b86fa49c14..0eb4305f99 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 b86fa49c14..0eb4305f99 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 faf2b132d6..bfa4198e3f 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.20.0 +// sqlc v1.29.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 b7f6c5250c..aa5adc4c7a 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2f2413f1cb..46ab9906e7 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.20.0 +// sqlc v1.29.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 cea86167e4..bed1dd16d8 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 25cf4ab4ba..4091af4a70 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 25cf4ab4ba..4091af4a70 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 2c4c212d2b..f7d40247ae 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.20.0 +// sqlc v1.29.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 5803e084ee..406c20ed28 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 3b3fc9dbab..0b4ed036b0 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.20.0 +// sqlc v1.29.0 package querytest @@ -17,3 +17,7 @@ type Memory struct { CreatedAt time.Time UpdatedAt sql.NullTime } + +type Vampire struct { + ID uuid.UUID +} 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 5d5ac4cc3b..57204993b2 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.20.0 +// sqlc v1.29.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 0124342193..17b349d68e 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql index e85e75f37a..5f539d7a14 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v4/schema.sql @@ -1,7 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + CREATE TABLE memories ( id uuid PRIMARY KEY DEFAULT gen_random_uuid (), vampire_id uuid REFERENCES vampires (id) NOT NULL, created_at timestamp NOT NULL DEFAULT NOW(), updated_at timestamp ); - 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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 03a7dc05d5..12351774fe 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.20.0 +// sqlc v1.29.0 package querytest @@ -14,3 +14,7 @@ type Memory struct { CreatedAt pgtype.Timestamp UpdatedAt pgtype.Timestamp } + +type Vampire struct { + ID pgtype.UUID +} 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 35ad23194c..312a10271e 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.20.0 +// sqlc v1.29.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 122d9daa98..35912c29f0 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql index e85e75f37a..5f539d7a14 100644 --- a/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql +++ b/internal/endtoend/testdata/unnest/postgresql/pgx/v5/schema.sql @@ -1,7 +1,10 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + CREATE TABLE memories ( id uuid PRIMARY KEY DEFAULT gen_random_uuid (), vampire_id uuid REFERENCES vampires (id) NOT NULL, created_at timestamp NOT NULL DEFAULT NOW(), updated_at timestamp ); - diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/db.go index 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 3b3fc9dbab..0b4ed036b0 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.20.0 +// sqlc v1.29.0 package querytest @@ -17,3 +17,7 @@ type Memory struct { CreatedAt time.Time UpdatedAt sql.NullTime } + +type Vampire struct { + ID uuid.UUID +} diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go b/internal/endtoend/testdata/unnest/postgresql/stdlib/go/querier.go index 5d5ac4cc3b..57204993b2 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.20.0 +// sqlc v1.29.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 c8c4629dbb..e90e010168 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.20.0 +// sqlc v1.29.0 // source: query.sql package querytest diff --git a/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql b/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql index 1780ad7ad3..5f539d7a14 100644 --- a/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql +++ b/internal/endtoend/testdata/unnest/postgresql/stdlib/schema.sql @@ -1,3 +1,7 @@ +CREATE TABLE vampires ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid () +); + CREATE TABLE memories ( id uuid PRIMARY KEY DEFAULT gen_random_uuid (), vampire_id uuid REFERENCES vampires (id) NOT NULL, 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..e83d6a948c --- /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.29.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..6dcdc84de9 --- /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.29.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..c6161a4eb6 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 d94b05b508..ca9ee42194 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.20.0 +// sqlc v1.29.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 5eceacda82..420ef66445 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.20.0 +// sqlc v1.29.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 401483b51a..5c96013fcb 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 d94b05b508..ca9ee42194 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.20.0 +// sqlc v1.29.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 5eceacda82..420ef66445 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.20.0 +// sqlc v1.29.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 401483b51a..5c96013fcb 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 d94b05b508..ca9ee42194 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.20.0 +// sqlc v1.29.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 5eceacda82..420ef66445 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.20.0 +// sqlc v1.29.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 36380b56f9..363cd866c3 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 47965d3446..0ad95629ba 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.20.0 +// sqlc v1.29.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 774b681a07..8d6bef8c40 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 c08dc3c0f5..bb4d3bb914 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.20.0 +// sqlc v1.29.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 02545fd90f..81c799b949 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.20.0 +// sqlc v1.29.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..e83d6a948c --- /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.29.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..651df915c8 --- /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.29.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..0109fcb660 --- /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.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 24ef66823e..f1cff592f2 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.20.0 +// sqlc v1.29.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 d454031d4f..f8a2f41afb 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 f96def044f..f28620929a 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.20.0 +// sqlc v1.29.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 28507e0365..52ba565a87 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 24ef66823e..f1cff592f2 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.20.0 +// sqlc v1.29.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 9370ae58dd..586c451438 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 56d5c8962a..2c78dba058 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.20.0 +// sqlc v1.29.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 aae2c9b500..15299d1f6a 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 5bd0b2eaff..64fda3c52f 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.20.0 +// sqlc v1.29.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 a9ebcc052a..a75bb485e1 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.20.0 +// sqlc v1.29.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 bf8f8e35bc..0c56c2b4e8 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.20.0 +// sqlc v1.29.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 2f651fe972..fdf9cb64a7 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.20.0 +// sqlc v1.29.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 4e0cd1f8be..3f79dc52c5 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 30aa504339..071e3e4a62 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 fc990718f2..bbbbad3aee 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 fc990718f2..bbbbad3aee 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 ddb83be5c0..9c572fc113 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 30aa504339..071e3e4a62 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 1fbedb9daa..9bba11c618 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.20.0 +// sqlc v1.29.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 f0ea7fd21a..635cce3c5d 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 8cf4e3c54d..1efde76806 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.20.0 +// sqlc v1.29.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 e715a0f400..e83d6a948c 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 8cf4e3c54d..1efde76806 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 d48ebce7a3..d4d54ca806 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 ae2e7c195d..6be8f8337f 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.20.0 +// sqlc v1.29.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 1fbedb9daa..9bba11c618 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 f6e2dbae74..091e34ad50 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.20.0 +// sqlc v1.29.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 8b27b8731f..311df534a4 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.0 package querytest diff --git a/internal/endtoend/testdata/upsert/sqlite/go/models.go b/internal/endtoend/testdata/upsert/sqlite/go/models.go index 79dab75b73..e6f5eb3cfa 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.20.0 +// sqlc v1.29.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 f1dcef8b46..82e1fb67ef 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 89d94086d4..952ef06bd3 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.20.0 +// sqlc v1.29.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 139d51f559..77ddaa46fd 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.20.0 +// sqlc v1.29.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..a92cd6e8eb --- /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.29.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..952ef06bd3 --- /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.29.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..5d84858482 --- /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.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 89d94086d4..952ef06bd3 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.20.0 +// sqlc v1.29.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 f319c7876d..cb5c4bf1b4 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.20.0 +// sqlc v1.29.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 8fb3579832..27fdcc4164 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.20.0 +// sqlc v1.29.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 ddb6b6f3f6..fcbc25122e 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.20.0 +// sqlc v1.29.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 2fce7ade87..dc295cd4e0 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.20.0 +// sqlc v1.29.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 57406b68e8..a92cd6e8eb 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.20.0 +// sqlc v1.29.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 bab8ebff14..880fb287f7 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.20.0 +// sqlc v1.29.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 3100a60b45..fcfdc7b5c0 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.20.0 +// sqlc v1.29.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 new file mode 100644 index 0000000000..8c776c74b9 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/gen/env.json @@ -0,0 +1,6 @@ +{ + "env": [ + "SQLC_VERSION=v1.29.0", + "SQLC_DUMMY_VALUE=true" + ] +} diff --git a/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/query.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/query.sql new file mode 100644 index 0000000000..75e38b2caf --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/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_test/schema.sql b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/schema.sql new file mode 100644 index 0000000000..b4fad78497 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/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_test/sqlc.json b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/sqlc.json new file mode 100644 index 0000000000..38e6773a25 --- /dev/null +++ b/internal/endtoend/testdata/wasm_plugin_sqlc_gen_test/sqlc.json @@ -0,0 +1,26 @@ +{ + "version": "2", + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "test" + } + ] + } + ], + "plugins": [ + { + "name": "test", + "env": ["SQLC_DUMMY_VALUE"], + "wasm": { + "url": "https://github.com/sqlc-dev/sqlc-gen-test/releases/download/v0.1.0/sqlc-gen-test.wasm", + "sha256": "138220eae508d4b65a5a8cea555edd155eb2290daf576b7a8b96949acfeb3790" + } + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000000..a92cd6e8eb --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/go/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.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/where_collate/sqlite/go/models.go b/internal/endtoend/testdata/where_collate/sqlite/go/models.go new file mode 100644 index 0000000000..ad19637871 --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/go/models.go @@ -0,0 +1,10 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 + +package querytest + +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 new file mode 100644 index 0000000000..28ce00a979 --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/go/query.sql.go @@ -0,0 +1,23 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const getAccountByName = `-- name: GetAccountByName :one +SELECT id, name FROM accounts +WHERE name = ? COLLATE NOCASE +LIMIT 1 +` + +func (q *Queries) GetAccountByName(ctx context.Context, name string) (Account, error) { + row := q.db.QueryRowContext(ctx, getAccountByName, name) + var i Account + err := row.Scan(&i.ID, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/where_collate/sqlite/query.sql b/internal/endtoend/testdata/where_collate/sqlite/query.sql new file mode 100644 index 0000000000..647c3ebc07 --- /dev/null +++ b/internal/endtoend/testdata/where_collate/sqlite/query.sql @@ -0,0 +1,4 @@ +-- name: GetAccountByName :one +SELECT * FROM accounts +WHERE name = ? COLLATE NOCASE +LIMIT 1; \ No newline at end of file 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 new file mode 100644 index 0000000000..ea4a23425f --- /dev/null +++ b/internal/endtoend/testdata/where_collate/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/wrap_errors/mysql/db/db.go b/internal/endtoend/testdata/wrap_errors/mysql/db/db.go new file mode 100644 index 0000000000..e2b0a86b13 --- /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.29.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..c665426db7 --- /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.29.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..380dc952de --- /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.29.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..7cdd263bbf --- /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.29.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..a786490b52 --- /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.29.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..00f5b4aab4 --- /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.29.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..e2b0a86b13 --- /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.29.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..c665426db7 --- /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.29.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..c2da6db2c5 --- /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.29.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..e2b0a86b13 --- /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.29.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..c665426db7 --- /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.29.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..7f5111c266 --- /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.29.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 aa3deb3dc7..133b5bc74a 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.20.0 +// sqlc v1.29.0 package override diff --git a/internal/endtoend/testdata/yaml_overrides/go/models.go b/internal/endtoend/testdata/yaml_overrides/go/models.go index 75f8242956..47140f9fad 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.20.0 +// sqlc v1.29.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..5a9ac42c22 --- /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.29.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 d453189e2c..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) { @@ -51,26 +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, "postgresql")); found { - db, cleanup := sqltest.CreatePostgreSQLDatabase(t, tc, false, []string{s}) - defer db.Close() - defer cleanup() - } - 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 6b03774ebc..6d95a75064 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,6 +720,7 @@ 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(), @@ -940,10 +915,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) } @@ -953,7 +924,18 @@ func (c *cc) convertIndexPartSpecification(n *pcast.IndexPartSpecification) ast. } func (c *cc) convertIsNullExpr(n *pcast.IsNullExpr) ast.Node { - return todo(n) + op := ast.BoolExprTypeIsNull + if n.Not { + op = ast.BoolExprTypeIsNotNull + } + return &ast.BoolExpr{ + Boolop: op, + Args: &ast.List{ + Items: []ast.Node{ + c.convert(n.Expr), + }, + }, + } } func (c *cc) convertIsTruthExpr(n *pcast.IsTruthExpr) ast.Node { @@ -1039,18 +1021,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 } @@ -1092,7 +1063,7 @@ func (c *cc) convertPatternInExpr(n *pcast.PatternInExpr) ast.Node { return in } -func (c *cc) convertPatternLikeExpr(n *pcast.PatternLikeExpr) ast.Node { +func (c *cc) convertPatternLikeExpr(n *pcast.PatternLikeOrIlikeExpr) ast.Node { return &ast.A_Expr{ Kind: ast.A_Expr_Kind(9), Name: &ast.List{ @@ -1254,7 +1225,12 @@ func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node { func (c *cc) convertSetOprStmt(n *pcast.SetOprStmt) ast.Node { if n.SelectList != nil { - return c.convertSetOprSelectList(n.SelectList) + sn := c.convertSetOprSelectList(n.SelectList) + if ss, ok := sn.(*ast.SelectStmt); ok && n.Limit != nil { + ss.LimitOffset = c.convert(n.Limit.Offset) + ss.LimitCount = c.convert(n.Limit.Count) + } + return sn } return todo(n) } @@ -1332,7 +1308,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), } @@ -1418,6 +1394,48 @@ func (c *cc) convertWindowSpec(n *pcast.WindowSpec) ast.Node { return todo(n) } +func (c *cc) convertCallStmt(n *pcast.CallStmt) ast.Node { + var funcname ast.List + for _, s := range []string{n.Procedure.Schema.L, n.Procedure.FnName.L} { + if s != "" { + funcname.Items = append(funcname.Items, NewIdentifier(s)) + } + } + var args ast.List + for _, a := range n.Procedure.Args { + args.Items = append(args.Items, c.convert(a)) + } + return &ast.CallStmt{ + FuncCall: &ast.FuncCall{ + Func: &ast.FuncName{ + Schema: n.Procedure.Schema.L, + Name: n.Procedure.FnName.L, + }, + Funcname: &funcname, + Args: &args, + Location: n.OriginTextPosition(), + }, + } +} + +func (c *cc) convertProcedureInfo(n *pcast.ProcedureInfo) ast.Node { + var params ast.List + for _, sp := range n.ProcedureParam { + paramName := sp.ParamName + params.Items = append(params.Items, &ast.FuncParam{ + Name: ¶mName, + Type: &ast.TypeName{Name: types.TypeToStr(sp.ParamType.GetType(), sp.ParamType.GetCharset())}, + }) + } + return &ast.CreateFunctionStmt{ + Params: ¶ms, + Func: &ast.FuncName{ + Schema: n.ProcedureName.Schema.L, + Name: n.ProcedureName.Name.L, + }, + } +} + func (c *cc) convert(node pcast.Node) ast.Node { switch n := node.(type) { @@ -1472,6 +1490,9 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.ByItem: return c.convertByItem(n) + case *pcast.CallStmt: + return c.convertCallStmt(n) + case *pcast.CaseExpr: return c.convertCaseExpr(n) @@ -1613,9 +1634,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) @@ -1676,7 +1694,7 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.PatternInExpr: return c.convertPatternInExpr(n) - case *pcast.PatternLikeExpr: + case *pcast.PatternLikeOrIlikeExpr: return c.convertPatternLikeExpr(n) case *pcast.PatternRegexpExpr: @@ -1691,6 +1709,9 @@ func (c *cc) convert(node pcast.Node) ast.Node { case *pcast.PrivElem: return c.convertPrivElem(n) + case *pcast.ProcedureInfo: + return c.convertProcedureInfo(n) + case *pcast.RecoverTableStmt: return c.convertRecoverTableStmt(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..cd84942700 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" ) 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 3dbe9ee663..29c06fb285 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" @@ -29,10 +28,14 @@ func todo(funcname string, n node) *ast.TODO { } func identifier(id string) string { + if len(id) >= 2 && id[0] == '"' && id[len(id)-1] == '"' { + unquoted, _ := strconv.Unquote(id) + return unquoted + } return strings.ToLower(id) } -func NewIdentifer(t string) *ast.String { +func NewIdentifier(t string) *ast.String { return &ast.String{Str: identifier(t)} } @@ -200,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, } @@ -293,7 +296,7 @@ func (c *cc) convertFuncContext(n *parser.Expr_functionContext) ast.Node { }, Funcname: &ast.List{ Items: []ast.Node{ - NewIdentifer(funcName), + NewIdentifier(funcName), }, }, AggStar: n.STAR() != nil, @@ -317,16 +320,16 @@ func (c *cc) convertColumnNameExpr(n *parser.Expr_qualified_column_nameContext) if schema, ok := n.Schema_name().(*parser.Schema_nameContext); ok { schemaText := schema.GetText() if schemaText != "" { - items = append(items, NewIdentifer(schemaText)) + items = append(items, NewIdentifier(schemaText)) } } if table, ok := n.Table_name().(*parser.Table_nameContext); ok { tableName := table.GetText() if tableName != "" { - items = append(items, NewIdentifer(tableName)) + items = append(items, NewIdentifier(tableName)) } } - items = append(items, NewIdentifer(n.Column_name().GetText())) + items = append(items, NewIdentifier(n.Column_name().GetText())) return &ast.ColumnRef{ Fields: &ast.List{ Items: items, @@ -371,22 +374,16 @@ func (c *cc) convertComparison(n *parser.Expr_comparisonContext) ast.Node { } func (c *cc) convertMultiSelect_stmtContext(n *parser.Select_stmtContext) ast.Node { - var tables []ast.Node - var cols []ast.Node - var where ast.Node - var groups = []ast.Node{} - var having ast.Node - var ctes []ast.Node - + var ctes ast.List if ct := n.Common_table_stmt(); ct != nil { recursive := ct.RECURSIVE_() != nil for _, cte := range ct.AllCommon_table_expression() { tableName := identifier(cte.Table_name().GetText()) var cteCols ast.List for _, col := range cte.AllColumn_name() { - cteCols.Items = append(cteCols.Items, NewIdentifer(col.GetText())) + cteCols.Items = append(cteCols.Items, NewIdentifier(col.GetText())) } - ctes = append(ctes, &ast.CommonTableExpr{ + ctes.Items = append(ctes.Items, &ast.CommonTableExpr{ Ctename: &tableName, Ctequery: c.convert(cte.Select_stmt()), Location: cte.GetStart().GetStart(), @@ -396,20 +393,24 @@ func (c *cc) convertMultiSelect_stmtContext(n *parser.Select_stmtContext) ast.No } } - for _, icore := range n.AllSelect_core() { + var selectStmt *ast.SelectStmt + for s, icore := range n.AllSelect_core() { core, ok := icore.(*parser.Select_coreContext) if !ok { continue } - cols = append(cols, c.getCols(core)...) - tables = append(tables, c.getTables(core)...) + cols := c.getCols(core) + tables := c.getTables(core) + var where ast.Node i := 0 if core.WHERE_() != nil { where = c.convert(core.Expr(i)) i++ } + var groups ast.List + var having ast.Node if core.GROUP_() != nil { l := len(core.AllExpr()) - i if core.HAVING_() != nil { @@ -418,33 +419,103 @@ func (c *cc) convertMultiSelect_stmtContext(n *parser.Select_stmtContext) ast.No } for i < l { - groups = append(groups, c.convert(core.Expr(i))) + groups.Items = append(groups.Items, c.convert(core.Expr(i))) i++ } } - } - - window := &ast.List{Items: []ast.Node{}} - if n.Order_by_stmt() != nil { - window.Items = append(window.Items, c.convert(n.Order_by_stmt())) + var window ast.List + if core.WINDOW_() != nil { + for w, windowNameCtx := range core.AllWindow_name() { + windowName := identifier(windowNameCtx.GetText()) + windowDef := core.Window_defn(w) + + _ = windowDef.Base_window_name() + var partitionBy ast.List + if windowDef.PARTITION_() != nil { + for _, e := range windowDef.AllExpr() { + partitionBy.Items = append(partitionBy.Items, c.convert(e)) + } + } + var orderBy ast.List + if windowDef.ORDER_() != nil { + for _, e := range windowDef.AllOrdering_term() { + oterm := e.(*parser.Ordering_termContext) + sortByDir := ast.SortByDirDefault + if ad := oterm.Asc_desc(); ad != nil { + if ad.ASC_() != nil { + sortByDir = ast.SortByDirAsc + } else { + sortByDir = ast.SortByDirDesc + } + } + sortByNulls := ast.SortByNullsDefault + if oterm.NULLS_() != nil { + if oterm.FIRST_() != nil { + sortByNulls = ast.SortByNullsFirst + } else { + sortByNulls = ast.SortByNullsLast + } + } + + orderBy.Items = append(orderBy.Items, &ast.SortBy{ + Node: c.convert(oterm.Expr()), + SortbyDir: sortByDir, + SortbyNulls: sortByNulls, + UseOp: &ast.List{}, + }) + } + } + window.Items = append(window.Items, &ast.WindowDef{ + Name: &windowName, + PartitionClause: &partitionBy, + OrderClause: &orderBy, + FrameOptions: 0, // todo + StartOffset: &ast.TODO{}, + EndOffset: &ast.TODO{}, + Location: windowNameCtx.GetStart().GetStart(), + }) + } + } + sel := &ast.SelectStmt{ + FromClause: &ast.List{Items: tables}, + TargetList: &ast.List{Items: cols}, + WhereClause: where, + GroupClause: &groups, + HavingClause: having, + WindowClause: &window, + ValuesLists: &ast.List{}, + } + if selectStmt == nil { + selectStmt = sel + } else { + co := n.Compound_operator(s - 1) + so := ast.None + all := false + switch { + case co.UNION_() != nil: + so = ast.Union + all = co.ALL_() != nil + case co.INTERSECT_() != nil: + so = ast.Intersect + case co.EXCEPT_() != nil: + so = ast.Except + } + selectStmt = &ast.SelectStmt{ + TargetList: &ast.List{}, + FromClause: &ast.List{}, + Op: so, + All: all, + Larg: selectStmt, + Rarg: sel, + } + } } limitCount, limitOffset := c.convertLimit_stmtContext(n.Limit_stmt()) - - return &ast.SelectStmt{ - FromClause: &ast.List{Items: tables}, - TargetList: &ast.List{Items: cols}, - WhereClause: where, - GroupClause: &ast.List{Items: groups}, - HavingClause: having, - WindowClause: window, - LimitCount: limitCount, - LimitOffset: limitOffset, - ValuesLists: &ast.List{}, - WithClause: &ast.WithClause{ - Ctes: &ast.List{Items: ctes}, - }, - } + selectStmt.LimitCount = limitCount + selectStmt.LimitOffset = limitOffset + selectStmt.WithClause = &ast.WithClause{Ctes: &ctes} + return selectStmt } func (c *cc) convertExprListContext(n *parser.Expr_listContext) ast.Node { @@ -456,17 +527,46 @@ func (c *cc) convertExprListContext(n *parser.Expr_listContext) ast.Node { } func (c *cc) getTables(core *parser.Select_coreContext) []ast.Node { - var tables []ast.Node - tables = append(tables, c.convertTablesOrSubquery(core.AllTable_or_subquery())...) - if core.Join_clause() != nil { - join, ok := core.Join_clause().(*parser.Join_clauseContext) - if ok { - tables = append(tables, c.convertTablesOrSubquery(join.AllTable_or_subquery())...) + join := core.Join_clause().(*parser.Join_clauseContext) + tables := c.convertTablesOrSubquery(join.AllTable_or_subquery()) + table := tables[0] + for i, t := range tables[1:] { + joinExpr := &ast.JoinExpr{ + Larg: table, + Rarg: t, + } + jo := join.Join_operator(i) + if jo.NATURAL_() != nil { + joinExpr.IsNatural = true + } + switch { + case jo.CROSS_() != nil || jo.INNER_() != nil: + joinExpr.Jointype = ast.JoinTypeInner + case jo.LEFT_() != nil: + joinExpr.Jointype = ast.JoinTypeLeft + case jo.RIGHT_() != nil: + joinExpr.Jointype = ast.JoinTypeRight + case jo.FULL_() != nil: + joinExpr.Jointype = ast.JoinTypeFull + } + jc := join.Join_constraint(i) + switch { + case jc.ON_() != nil: + joinExpr.Quals = c.convert(jc.Expr()) + case jc.USING_() != nil: + var using ast.List + for _, cn := range jc.AllColumn_name() { + using.Items = append(using.Items, NewIdentifier(cn.GetText())) + } + joinExpr.UsingClause = &using + } + table = joinExpr } + return []ast.Node{table} + } else { + return c.convertTablesOrSubquery(core.AllTable_or_subquery()) } - - return tables } func (c *cc) getCols(core *parser.Select_coreContext) []ast.Node { @@ -492,7 +592,7 @@ func (c *cc) getCols(core *parser.Select_coreContext) []ast.Node { continue } - if col.AS_() != nil { + if col.Column_alias() != nil { name := identifier(col.Column_alias().GetText()) target.Name = &name } @@ -506,7 +606,7 @@ func (c *cc) getCols(core *parser.Select_coreContext) []ast.Node { func (c *cc) convertWildCardField(n *parser.Result_columnContext) *ast.ColumnRef { items := []ast.Node{} if n.Table_name() != nil { - items = append(items, NewIdentifer(n.Table_name().GetText())) + items = append(items, NewIdentifier(n.Table_name().GetText())) } items = append(items, &ast.A_Star{}) @@ -663,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)), @@ -675,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{ @@ -754,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, } @@ -763,7 +863,7 @@ func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { rel.Schemaname = &schemaName } if n.Table_alias() != nil { - tableAlias := n.Table_alias().GetText() + tableAlias := identifier(n.Table_alias().GetText()) rel.Alias = &ast.Alias{ Aliasname: &tableAlias, } @@ -781,27 +881,41 @@ func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { insert.SelectStmt = ss } } else { + var valuesLists ast.List + var values *ast.List + for _, cn := range n.GetChildren() { + switch cn := cn.(type) { + case antlr.TerminalNode: + switch cn.GetSymbol().GetTokenType() { + case parser.SQLiteParserVALUES_: + values = &ast.List{} + case parser.SQLiteParserOPEN_PAR: + if values != nil { + values = &ast.List{} + } + case parser.SQLiteParserCOMMA: + case parser.SQLiteParserCLOSE_PAR: + if values != nil { + valuesLists.Items = append(valuesLists.Items, values) + } + } + case parser.IExprContext: + if values != nil { + values.Items = append(values.Items, c.convert(cn)) + } + } + } + insert.SelectStmt = &ast.SelectStmt{ FromClause: &ast.List{}, TargetList: &ast.List{}, - ValuesLists: c.convertExprLists(n.AllExpr()), + ValuesLists: &valuesLists, } } return insert } -func (c *cc) convertExprLists(lists []parser.IExprContext) *ast.List { - list := &ast.List{Items: []ast.Node{}} - n := len(lists) - inner := &ast.List{Items: []ast.Node{}} - for i := 0; i < n; i++ { - inner.Items = append(inner.Items, c.convert(lists[i])) - } - list.Items = append(list.Items, inner) - return list -} - func (c *cc) convertColumnNames(cols []parser.IColumn_nameContext) *ast.List { list := &ast.List{Items: []ast.Node{}} for _, c := range cols { @@ -822,7 +936,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(), @@ -833,7 +947,7 @@ func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast rv.Schemaname = &schema } if from.Table_alias() != nil { - alias := from.Table_alias().GetText() + alias := identifier(from.Table_alias().GetText()) rv.Alias = &ast.Alias{Aliasname: &alias} } if from.Table_alias_fallback() != nil { @@ -853,7 +967,7 @@ func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast }, Funcname: &ast.List{ Items: []ast.Node{ - NewIdentifer(rel), + NewIdentifier(rel), }, }, Args: &ast.List{ @@ -866,7 +980,7 @@ func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast } if from.Table_alias() != nil { - alias := from.Table_alias().GetText() + alias := identifier(from.Table_alias().GetText()) rf.Alias = &ast.Alias{Aliasname: &alias} } @@ -877,7 +991,7 @@ func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast } if from.Table_alias() != nil { - alias := from.Table_alias().GetText() + alias := identifier(from.Table_alias().GetText()) rs.Alias = &ast.Alias{Aliasname: &alias} } @@ -965,7 +1079,7 @@ func (c *cc) convertCastExpr(n *parser.Expr_castContext) ast.Node { TypeName: &ast.TypeName{ Name: name, Names: &ast.List{Items: []ast.Node{ - NewIdentifer(name), + NewIdentifier(name), }}, ArrayBounds: &ast.List{}, }, @@ -973,6 +1087,36 @@ func (c *cc) convertCastExpr(n *parser.Expr_castContext) ast.Node { } } +func (c *cc) convertCollateExpr(n *parser.Expr_collateContext) ast.Node { + return &ast.CollateExpr{ + Xpr: c.convert(n.Expr()), + Arg: NewIdentifier(n.Collation_name().GetText()), + Location: n.GetStart().GetStart(), + } +} + +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) { @@ -1018,14 +1162,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) @@ -1033,6 +1177,9 @@ func (c *cc) convert(node node) ast.Node { case *parser.Expr_betweenContext: return c.convertBetweenExpr(n) + case *parser.Expr_collateContext: + return c.convertCollateExpr(n) + case *parser.Factored_select_stmtContext: // TODO: need to handle this return todo("convert(case=parser.Factored_select_stmtContext)", n) @@ -1058,6 +1205,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 a23fa2021f..49434e8bd3 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 ( @@ -293,7 +294,7 @@ expr: | NOT_EQ2 | IS_ | IS_ NOT_ - | IN_ + | NOT_? IN_ | LIKE_ | GLOB_ | MATCH_ @@ -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 @@ -398,7 +399,7 @@ select_stmt: ; join_clause: - table_or_subquery (join_operator table_or_subquery join_constraint?)* + table_or_subquery (join_operator table_or_subquery join_constraint)* ; select_core: @@ -454,8 +455,8 @@ join_operator: ; join_constraint: - ON_ expr - | USING_ OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR + (ON_ expr + | USING_ OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR)? ; compound_operator: diff --git a/internal/engine/sqlite/parser/SQLiteParser.interp b/internal/engine/sqlite/parser/SQLiteParser.interp index 063a1635e9..d035d5ac01 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, 2173, 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, 1, 34, 3, 34, 1036, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1047, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1056, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1064, 8, 34, 10, 34, 12, 34, 1067, 9, 34, 3, 34, 1069, 8, 34, 1, 34, 1, 34, 1, 34, 1, 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, 1, 34, 5, 34, 1088, 8, 34, 10, 34, 12, 34, 1091, 9, 34, 3, 34, 1093, 8, 34, 1, 34, 1, 34, 3, 34, 1097, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1104, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1110, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1117, 8, 34, 5, 34, 1119, 8, 34, 10, 34, 12, 34, 1122, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1130, 8, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 3, 37, 1137, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1144, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1150, 8, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1155, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1161, 8, 37, 10, 37, 12, 37, 1164, 9, 37, 1, 37, 1, 37, 3, 37, 1168, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1175, 8, 37, 10, 37, 12, 37, 1178, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1186, 8, 37, 10, 37, 12, 37, 1189, 9, 37, 1, 37, 1, 37, 5, 37, 1193, 8, 37, 10, 37, 12, 37, 1196, 9, 37, 1, 37, 3, 37, 1199, 8, 37, 1, 37, 3, 37, 1202, 8, 37, 1, 37, 3, 37, 1205, 8, 37, 1, 37, 1, 37, 3, 37, 1209, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1217, 8, 38, 10, 38, 12, 38, 1220, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1225, 8, 38, 3, 38, 1227, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1235, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1242, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1247, 8, 38, 10, 38, 12, 38, 1250, 9, 38, 1, 38, 1, 38, 3, 38, 1254, 8, 38, 3, 38, 1256, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1262, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1271, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1276, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1283, 8, 41, 1, 41, 1, 41, 3, 41, 1287, 8, 41, 3, 41, 1289, 8, 41, 1, 42, 3, 42, 1292, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1298, 8, 42, 10, 42, 12, 42, 1301, 9, 42, 1, 42, 3, 42, 1304, 8, 42, 1, 42, 3, 42, 1307, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 3, 43, 1313, 8, 43, 5, 43, 1315, 8, 43, 10, 43, 12, 43, 1318, 9, 43, 1, 44, 1, 44, 3, 44, 1322, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1327, 8, 44, 10, 44, 12, 44, 1330, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1336, 8, 44, 10, 44, 12, 44, 1339, 9, 44, 1, 44, 3, 44, 1342, 8, 44, 3, 44, 1344, 8, 44, 1, 44, 1, 44, 3, 44, 1348, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1355, 8, 44, 10, 44, 12, 44, 1358, 9, 44, 1, 44, 1, 44, 3, 44, 1362, 8, 44, 3, 44, 1364, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1375, 8, 44, 10, 44, 12, 44, 1378, 9, 44, 3, 44, 1380, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1387, 8, 44, 10, 44, 12, 44, 1390, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1398, 8, 44, 10, 44, 12, 44, 1401, 9, 44, 1, 44, 1, 44, 5, 44, 1405, 8, 44, 10, 44, 12, 44, 1408, 9, 44, 3, 44, 1410, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1415, 8, 46, 1, 46, 1, 46, 3, 46, 1419, 8, 46, 1, 46, 3, 46, 1422, 8, 46, 1, 47, 3, 47, 1425, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1430, 8, 47, 1, 47, 1, 47, 3, 47, 1434, 8, 47, 1, 47, 4, 47, 1437, 8, 47, 11, 47, 12, 47, 1438, 1, 47, 3, 47, 1442, 8, 47, 1, 47, 3, 47, 1445, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1450, 8, 48, 1, 48, 1, 48, 3, 48, 1454, 8, 48, 1, 48, 3, 48, 1457, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1464, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1469, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1476, 8, 48, 10, 48, 12, 48, 1479, 9, 48, 1, 48, 1, 48, 3, 48, 1483, 8, 48, 1, 48, 3, 48, 1486, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1492, 8, 48, 10, 48, 12, 48, 1495, 9, 48, 1, 48, 3, 48, 1498, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1506, 8, 48, 1, 48, 3, 48, 1509, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1514, 8, 48, 1, 48, 1, 48, 3, 48, 1518, 8, 48, 1, 48, 3, 48, 1521, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1528, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1533, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1540, 8, 48, 10, 48, 12, 48, 1543, 9, 48, 1, 48, 1, 48, 3, 48, 1547, 8, 48, 1, 48, 3, 48, 1550, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1556, 8, 48, 10, 48, 12, 48, 1559, 9, 48, 1, 48, 3, 48, 1562, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1570, 8, 48, 1, 48, 3, 48, 1573, 8, 48, 3, 48, 1575, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1584, 8, 49, 1, 49, 3, 49, 1587, 8, 49, 3, 49, 1589, 8, 49, 1, 50, 1, 50, 3, 50, 1593, 8, 50, 1, 50, 1, 50, 3, 50, 1597, 8, 50, 1, 50, 3, 50, 1600, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1605, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1614, 8, 51, 10, 51, 12, 51, 1617, 9, 51, 1, 51, 1, 51, 3, 51, 1621, 8, 51, 1, 52, 1, 52, 3, 52, 1625, 8, 52, 1, 52, 1, 52, 3, 52, 1629, 8, 52, 1, 53, 3, 53, 1632, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1637, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1643, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1650, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1655, 8, 53, 10, 53, 12, 53, 1658, 9, 53, 1, 53, 1, 53, 3, 53, 1662, 8, 53, 1, 53, 3, 53, 1665, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1671, 8, 54, 10, 54, 12, 54, 1674, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1679, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1684, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1690, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1697, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1702, 8, 55, 10, 55, 12, 55, 1705, 9, 55, 1, 55, 1, 55, 3, 55, 1709, 8, 55, 1, 55, 3, 55, 1712, 8, 55, 1, 55, 3, 55, 1715, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1720, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1725, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1732, 8, 56, 1, 57, 1, 57, 3, 57, 1736, 8, 57, 1, 57, 1, 57, 3, 57, 1740, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1750, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1757, 8, 59, 10, 59, 12, 59, 1760, 9, 59, 3, 59, 1762, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1769, 8, 59, 10, 59, 12, 59, 1772, 9, 59, 1, 59, 3, 59, 1775, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1783, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1790, 8, 60, 10, 60, 12, 60, 1793, 9, 60, 3, 60, 1795, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1802, 8, 60, 10, 60, 12, 60, 1805, 9, 60, 3, 60, 1807, 8, 60, 1, 60, 3, 60, 1810, 8, 60, 1, 60, 3, 60, 1813, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1823, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1832, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1839, 8, 63, 10, 63, 12, 63, 1842, 9, 63, 1, 63, 3, 63, 1845, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1852, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1857, 8, 64, 10, 64, 12, 64, 1860, 9, 64, 1, 64, 3, 64, 1863, 8, 64, 1, 64, 1, 64, 3, 64, 1867, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1874, 8, 65, 10, 65, 12, 65, 1877, 9, 65, 1, 65, 3, 65, 1880, 8, 65, 1, 65, 1, 65, 3, 65, 1884, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1889, 8, 65, 1, 66, 1, 66, 3, 66, 1893, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1898, 8, 66, 10, 66, 12, 66, 1901, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1908, 8, 67, 10, 67, 12, 67, 1911, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1917, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1922, 8, 69, 1, 69, 3, 69, 1925, 8, 69, 1, 69, 1, 69, 3, 69, 1929, 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, 1943, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1955, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1964, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1973, 8, 74, 1, 74, 1, 74, 3, 74, 1977, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1987, 8, 74, 1, 74, 3, 74, 1990, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1999, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2008, 8, 74, 1, 74, 3, 74, 2011, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2017, 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, 2031, 8, 74, 1, 74, 1, 74, 3, 74, 2035, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2046, 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2051, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2062, 8, 77, 11, 77, 12, 77, 2063, 1, 78, 1, 78, 1, 78, 4, 78, 2069, 8, 78, 11, 78, 12, 78, 2070, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2079, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, 2084, 8, 80, 5, 80, 2086, 8, 80, 10, 80, 12, 80, 2089, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2101, 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, 2114, 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, 2171, 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, 2477, 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, 1123, 1, 0, 0, 0, 72, 1133, 1, 0, 0, 0, 74, 1208, 1, 0, 0, 0, 76, 1210, 1, 0, 0, 0, 78, 1257, 1, 0, 0, 0, 80, 1275, 1, 0, 0, 0, 82, 1277, 1, 0, 0, 0, 84, 1291, 1, 0, 0, 0, 86, 1308, 1, 0, 0, 0, 88, 1409, 1, 0, 0, 0, 90, 1411, 1, 0, 0, 0, 92, 1414, 1, 0, 0, 0, 94, 1424, 1, 0, 0, 0, 96, 1574, 1, 0, 0, 0, 98, 1588, 1, 0, 0, 0, 100, 1604, 1, 0, 0, 0, 102, 1620, 1, 0, 0, 0, 104, 1628, 1, 0, 0, 0, 106, 1631, 1, 0, 0, 0, 108, 1666, 1, 0, 0, 0, 110, 1678, 1, 0, 0, 0, 112, 1719, 1, 0, 0, 0, 114, 1733, 1, 0, 0, 0, 116, 1741, 1, 0, 0, 0, 118, 1747, 1, 0, 0, 0, 120, 1778, 1, 0, 0, 0, 122, 1814, 1, 0, 0, 0, 124, 1824, 1, 0, 0, 0, 126, 1833, 1, 0, 0, 0, 128, 1848, 1, 0, 0, 0, 130, 1868, 1, 0, 0, 0, 132, 1890, 1, 0, 0, 0, 134, 1902, 1, 0, 0, 0, 136, 1912, 1, 0, 0, 0, 138, 1918, 1, 0, 0, 0, 140, 1930, 1, 0, 0, 0, 142, 1942, 1, 0, 0, 0, 144, 1954, 1, 0, 0, 0, 146, 1963, 1, 0, 0, 0, 148, 2050, 1, 0, 0, 0, 150, 2052, 1, 0, 0, 0, 152, 2055, 1, 0, 0, 0, 154, 2058, 1, 0, 0, 0, 156, 2065, 1, 0, 0, 0, 158, 2072, 1, 0, 0, 0, 160, 2076, 1, 0, 0, 0, 162, 2090, 1, 0, 0, 0, 164, 2092, 1, 0, 0, 0, 166, 2094, 1, 0, 0, 0, 168, 2096, 1, 0, 0, 0, 170, 2100, 1, 0, 0, 0, 172, 2102, 1, 0, 0, 0, 174, 2104, 1, 0, 0, 0, 176, 2106, 1, 0, 0, 0, 178, 2108, 1, 0, 0, 0, 180, 2113, 1, 0, 0, 0, 182, 2117, 1, 0, 0, 0, 184, 2119, 1, 0, 0, 0, 186, 2121, 1, 0, 0, 0, 188, 2123, 1, 0, 0, 0, 190, 2125, 1, 0, 0, 0, 192, 2127, 1, 0, 0, 0, 194, 2129, 1, 0, 0, 0, 196, 2131, 1, 0, 0, 0, 198, 2133, 1, 0, 0, 0, 200, 2135, 1, 0, 0, 0, 202, 2137, 1, 0, 0, 0, 204, 2139, 1, 0, 0, 0, 206, 2141, 1, 0, 0, 0, 208, 2143, 1, 0, 0, 0, 210, 2145, 1, 0, 0, 0, 212, 2147, 1, 0, 0, 0, 214, 2149, 1, 0, 0, 0, 216, 2151, 1, 0, 0, 0, 218, 2153, 1, 0, 0, 0, 220, 2155, 1, 0, 0, 0, 222, 2157, 1, 0, 0, 0, 224, 2159, 1, 0, 0, 0, 226, 2161, 1, 0, 0, 0, 228, 2170, 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, 1120, 1, 0, 0, 0, 1007, 1008, 10, 19, 0, 0, 1008, 1009, 5, 11, 0, 0, 1009, 1119, 3, 68, 34, 20, 1010, 1011, 10, 18, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1119, 3, 68, 34, 19, 1013, 1014, 10, 17, 0, 0, 1014, 1015, 7, 4, 0, 0, 1015, 1119, 3, 68, 34, 18, 1016, 1017, 10, 16, 0, 0, 1017, 1018, 7, 11, 0, 0, 1018, 1119, 3, 68, 34, 17, 1019, 1020, 10, 15, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1119, 3, 68, 34, 16, 1022, 1035, 10, 14, 0, 0, 1023, 1036, 5, 6, 0, 0, 1024, 1036, 5, 22, 0, 0, 1025, 1036, 5, 23, 0, 0, 1026, 1036, 5, 24, 0, 0, 1027, 1036, 5, 92, 0, 0, 1028, 1029, 5, 92, 0, 0, 1029, 1036, 5, 102, 0, 0, 1030, 1036, 5, 83, 0, 0, 1031, 1036, 5, 97, 0, 0, 1032, 1036, 5, 77, 0, 0, 1033, 1036, 5, 99, 0, 0, 1034, 1036, 5, 118, 0, 0, 1035, 1023, 1, 0, 0, 0, 1035, 1024, 1, 0, 0, 0, 1035, 1025, 1, 0, 0, 0, 1035, 1026, 1, 0, 0, 0, 1035, 1027, 1, 0, 0, 0, 1035, 1028, 1, 0, 0, 0, 1035, 1030, 1, 0, 0, 0, 1035, 1031, 1, 0, 0, 0, 1035, 1032, 1, 0, 0, 0, 1035, 1033, 1, 0, 0, 0, 1035, 1034, 1, 0, 0, 0, 1036, 1037, 1, 0, 0, 0, 1037, 1119, 3, 68, 34, 15, 1038, 1039, 10, 12, 0, 0, 1039, 1040, 5, 32, 0, 0, 1040, 1119, 3, 68, 34, 13, 1041, 1042, 10, 11, 0, 0, 1042, 1043, 5, 108, 0, 0, 1043, 1119, 3, 68, 34, 12, 1044, 1046, 10, 4, 0, 0, 1045, 1047, 5, 102, 0, 0, 1046, 1045, 1, 0, 0, 0, 1046, 1047, 1, 0, 0, 0, 1047, 1048, 1, 0, 0, 0, 1048, 1049, 5, 39, 0, 0, 1049, 1050, 3, 68, 34, 0, 1050, 1051, 5, 32, 0, 0, 1051, 1052, 3, 68, 34, 5, 1052, 1119, 1, 0, 0, 0, 1053, 1055, 10, 13, 0, 0, 1054, 1056, 5, 102, 0, 0, 1055, 1054, 1, 0, 0, 0, 1055, 1056, 1, 0, 0, 0, 1056, 1057, 1, 0, 0, 0, 1057, 1096, 5, 83, 0, 0, 1058, 1068, 5, 3, 0, 0, 1059, 1069, 3, 84, 42, 0, 1060, 1065, 3, 68, 34, 0, 1061, 1062, 5, 5, 0, 0, 1062, 1064, 3, 68, 34, 0, 1063, 1061, 1, 0, 0, 0, 1064, 1067, 1, 0, 0, 0, 1065, 1063, 1, 0, 0, 0, 1065, 1066, 1, 0, 0, 0, 1066, 1069, 1, 0, 0, 0, 1067, 1065, 1, 0, 0, 0, 1068, 1059, 1, 0, 0, 0, 1068, 1060, 1, 0, 0, 0, 1068, 1069, 1, 0, 0, 0, 1069, 1070, 1, 0, 0, 0, 1070, 1097, 5, 4, 0, 0, 1071, 1072, 3, 182, 91, 0, 1072, 1073, 5, 2, 0, 0, 1073, 1075, 1, 0, 0, 0, 1074, 1071, 1, 0, 0, 0, 1074, 1075, 1, 0, 0, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1097, 3, 184, 92, 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, 1083, 3, 226, 113, 0, 1083, 1092, 5, 3, 0, 0, 1084, 1089, 3, 68, 34, 0, 1085, 1086, 5, 5, 0, 0, 1086, 1088, 3, 68, 34, 0, 1087, 1085, 1, 0, 0, 0, 1088, 1091, 1, 0, 0, 0, 1089, 1087, 1, 0, 0, 0, 1089, 1090, 1, 0, 0, 0, 1090, 1093, 1, 0, 0, 0, 1091, 1089, 1, 0, 0, 0, 1092, 1084, 1, 0, 0, 0, 1092, 1093, 1, 0, 0, 0, 1093, 1094, 1, 0, 0, 0, 1094, 1095, 5, 4, 0, 0, 1095, 1097, 1, 0, 0, 0, 1096, 1058, 1, 0, 0, 0, 1096, 1074, 1, 0, 0, 0, 1096, 1080, 1, 0, 0, 0, 1097, 1119, 1, 0, 0, 0, 1098, 1099, 10, 7, 0, 0, 1099, 1100, 5, 45, 0, 0, 1100, 1119, 3, 192, 96, 0, 1101, 1103, 10, 6, 0, 0, 1102, 1104, 5, 102, 0, 0, 1103, 1102, 1, 0, 0, 0, 1103, 1104, 1, 0, 0, 0, 1104, 1105, 1, 0, 0, 0, 1105, 1106, 7, 13, 0, 0, 1106, 1109, 3, 68, 34, 0, 1107, 1108, 5, 67, 0, 0, 1108, 1110, 3, 68, 34, 0, 1109, 1107, 1, 0, 0, 0, 1109, 1110, 1, 0, 0, 0, 1110, 1119, 1, 0, 0, 0, 1111, 1116, 10, 5, 0, 0, 1112, 1117, 5, 93, 0, 0, 1113, 1117, 5, 103, 0, 0, 1114, 1115, 5, 102, 0, 0, 1115, 1117, 5, 104, 0, 0, 1116, 1112, 1, 0, 0, 0, 1116, 1113, 1, 0, 0, 0, 1116, 1114, 1, 0, 0, 0, 1117, 1119, 1, 0, 0, 0, 1118, 1007, 1, 0, 0, 0, 1118, 1010, 1, 0, 0, 0, 1118, 1013, 1, 0, 0, 0, 1118, 1016, 1, 0, 0, 0, 1118, 1019, 1, 0, 0, 0, 1118, 1022, 1, 0, 0, 0, 1118, 1038, 1, 0, 0, 0, 1118, 1041, 1, 0, 0, 0, 1118, 1044, 1, 0, 0, 0, 1118, 1053, 1, 0, 0, 0, 1118, 1098, 1, 0, 0, 0, 1118, 1101, 1, 0, 0, 0, 1118, 1111, 1, 0, 0, 0, 1119, 1122, 1, 0, 0, 0, 1120, 1118, 1, 0, 0, 0, 1120, 1121, 1, 0, 0, 0, 1121, 69, 1, 0, 0, 0, 1122, 1120, 1, 0, 0, 0, 1123, 1124, 5, 115, 0, 0, 1124, 1129, 5, 3, 0, 0, 1125, 1130, 5, 81, 0, 0, 1126, 1127, 7, 14, 0, 0, 1127, 1128, 5, 5, 0, 0, 1128, 1130, 3, 168, 84, 0, 1129, 1125, 1, 0, 0, 0, 1129, 1126, 1, 0, 0, 0, 1130, 1131, 1, 0, 0, 0, 1131, 1132, 5, 4, 0, 0, 1132, 71, 1, 0, 0, 0, 1133, 1134, 7, 15, 0, 0, 1134, 73, 1, 0, 0, 0, 1135, 1137, 3, 50, 25, 0, 1136, 1135, 1, 0, 0, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1143, 1, 0, 0, 0, 1138, 1144, 5, 88, 0, 0, 1139, 1144, 5, 122, 0, 0, 1140, 1141, 5, 88, 0, 0, 1141, 1142, 5, 108, 0, 0, 1142, 1144, 7, 8, 0, 0, 1143, 1138, 1, 0, 0, 0, 1143, 1139, 1, 0, 0, 0, 1143, 1140, 1, 0, 0, 0, 1144, 1145, 1, 0, 0, 0, 1145, 1149, 5, 91, 0, 0, 1146, 1147, 3, 182, 91, 0, 1147, 1148, 5, 2, 0, 0, 1148, 1150, 1, 0, 0, 0, 1149, 1146, 1, 0, 0, 0, 1149, 1150, 1, 0, 0, 0, 1150, 1151, 1, 0, 0, 0, 1151, 1154, 3, 184, 92, 0, 1152, 1153, 5, 33, 0, 0, 1153, 1155, 3, 208, 104, 0, 1154, 1152, 1, 0, 0, 0, 1154, 1155, 1, 0, 0, 0, 1155, 1167, 1, 0, 0, 0, 1156, 1157, 5, 3, 0, 0, 1157, 1162, 3, 190, 95, 0, 1158, 1159, 5, 5, 0, 0, 1159, 1161, 3, 190, 95, 0, 1160, 1158, 1, 0, 0, 0, 1161, 1164, 1, 0, 0, 0, 1162, 1160, 1, 0, 0, 0, 1162, 1163, 1, 0, 0, 0, 1163, 1165, 1, 0, 0, 0, 1164, 1162, 1, 0, 0, 0, 1165, 1166, 5, 4, 0, 0, 1166, 1168, 1, 0, 0, 0, 1167, 1156, 1, 0, 0, 0, 1167, 1168, 1, 0, 0, 0, 1168, 1198, 1, 0, 0, 0, 1169, 1170, 5, 145, 0, 0, 1170, 1171, 5, 3, 0, 0, 1171, 1176, 3, 68, 34, 0, 1172, 1173, 5, 5, 0, 0, 1173, 1175, 3, 68, 34, 0, 1174, 1172, 1, 0, 0, 0, 1175, 1178, 1, 0, 0, 0, 1176, 1174, 1, 0, 0, 0, 1176, 1177, 1, 0, 0, 0, 1177, 1179, 1, 0, 0, 0, 1178, 1176, 1, 0, 0, 0, 1179, 1194, 5, 4, 0, 0, 1180, 1181, 5, 5, 0, 0, 1181, 1182, 5, 3, 0, 0, 1182, 1187, 3, 68, 34, 0, 1183, 1184, 5, 5, 0, 0, 1184, 1186, 3, 68, 34, 0, 1185, 1183, 1, 0, 0, 0, 1186, 1189, 1, 0, 0, 0, 1187, 1185, 1, 0, 0, 0, 1187, 1188, 1, 0, 0, 0, 1188, 1190, 1, 0, 0, 0, 1189, 1187, 1, 0, 0, 0, 1190, 1191, 5, 4, 0, 0, 1191, 1193, 1, 0, 0, 0, 1192, 1180, 1, 0, 0, 0, 1193, 1196, 1, 0, 0, 0, 1194, 1192, 1, 0, 0, 0, 1194, 1195, 1, 0, 0, 0, 1195, 1199, 1, 0, 0, 0, 1196, 1194, 1, 0, 0, 0, 1197, 1199, 3, 84, 42, 0, 1198, 1169, 1, 0, 0, 0, 1198, 1197, 1, 0, 0, 0, 1199, 1201, 1, 0, 0, 0, 1200, 1202, 3, 76, 38, 0, 1201, 1200, 1, 0, 0, 0, 1201, 1202, 1, 0, 0, 0, 1202, 1204, 1, 0, 0, 0, 1203, 1205, 3, 58, 29, 0, 1204, 1203, 1, 0, 0, 0, 1204, 1205, 1, 0, 0, 0, 1205, 1209, 1, 0, 0, 0, 1206, 1207, 5, 56, 0, 0, 1207, 1209, 5, 145, 0, 0, 1208, 1136, 1, 0, 0, 0, 1208, 1206, 1, 0, 0, 0, 1209, 75, 1, 0, 0, 0, 1210, 1211, 5, 107, 0, 0, 1211, 1226, 5, 48, 0, 0, 1212, 1213, 5, 3, 0, 0, 1213, 1218, 3, 24, 12, 0, 1214, 1215, 5, 5, 0, 0, 1215, 1217, 3, 24, 12, 0, 1216, 1214, 1, 0, 0, 0, 1217, 1220, 1, 0, 0, 0, 1218, 1216, 1, 0, 0, 0, 1218, 1219, 1, 0, 0, 0, 1219, 1221, 1, 0, 0, 0, 1220, 1218, 1, 0, 0, 0, 1221, 1224, 5, 4, 0, 0, 1222, 1223, 5, 149, 0, 0, 1223, 1225, 3, 68, 34, 0, 1224, 1222, 1, 0, 0, 0, 1224, 1225, 1, 0, 0, 0, 1225, 1227, 1, 0, 0, 0, 1226, 1212, 1, 0, 0, 0, 1226, 1227, 1, 0, 0, 0, 1227, 1228, 1, 0, 0, 0, 1228, 1255, 5, 184, 0, 0, 1229, 1256, 5, 185, 0, 0, 1230, 1231, 5, 142, 0, 0, 1231, 1234, 5, 131, 0, 0, 1232, 1235, 3, 190, 95, 0, 1233, 1235, 3, 108, 54, 0, 1234, 1232, 1, 0, 0, 0, 1234, 1233, 1, 0, 0, 0, 1235, 1236, 1, 0, 0, 0, 1236, 1237, 5, 6, 0, 0, 1237, 1248, 3, 68, 34, 0, 1238, 1241, 5, 5, 0, 0, 1239, 1242, 3, 190, 95, 0, 1240, 1242, 3, 108, 54, 0, 1241, 1239, 1, 0, 0, 0, 1241, 1240, 1, 0, 0, 0, 1242, 1243, 1, 0, 0, 0, 1243, 1244, 5, 6, 0, 0, 1244, 1245, 3, 68, 34, 0, 1245, 1247, 1, 0, 0, 0, 1246, 1238, 1, 0, 0, 0, 1247, 1250, 1, 0, 0, 0, 1248, 1246, 1, 0, 0, 0, 1248, 1249, 1, 0, 0, 0, 1249, 1253, 1, 0, 0, 0, 1250, 1248, 1, 0, 0, 0, 1251, 1252, 5, 149, 0, 0, 1252, 1254, 3, 68, 34, 0, 1253, 1251, 1, 0, 0, 0, 1253, 1254, 1, 0, 0, 0, 1254, 1256, 1, 0, 0, 0, 1255, 1229, 1, 0, 0, 0, 1255, 1230, 1, 0, 0, 0, 1256, 77, 1, 0, 0, 0, 1257, 1261, 5, 112, 0, 0, 1258, 1259, 3, 182, 91, 0, 1259, 1260, 5, 2, 0, 0, 1260, 1262, 1, 0, 0, 0, 1261, 1258, 1, 0, 0, 0, 1261, 1262, 1, 0, 0, 0, 1262, 1263, 1, 0, 0, 0, 1263, 1270, 3, 204, 102, 0, 1264, 1265, 5, 6, 0, 0, 1265, 1271, 3, 80, 40, 0, 1266, 1267, 5, 3, 0, 0, 1267, 1268, 3, 80, 40, 0, 1268, 1269, 5, 4, 0, 0, 1269, 1271, 1, 0, 0, 0, 1270, 1264, 1, 0, 0, 0, 1270, 1266, 1, 0, 0, 0, 1270, 1271, 1, 0, 0, 0, 1271, 79, 1, 0, 0, 0, 1272, 1276, 3, 36, 18, 0, 1273, 1276, 3, 176, 88, 0, 1274, 1276, 5, 190, 0, 0, 1275, 1272, 1, 0, 0, 0, 1275, 1273, 1, 0, 0, 0, 1275, 1274, 1, 0, 0, 0, 1276, 81, 1, 0, 0, 0, 1277, 1288, 5, 119, 0, 0, 1278, 1289, 3, 192, 96, 0, 1279, 1280, 3, 182, 91, 0, 1280, 1281, 5, 2, 0, 0, 1281, 1283, 1, 0, 0, 0, 1282, 1279, 1, 0, 0, 0, 1282, 1283, 1, 0, 0, 0, 1283, 1286, 1, 0, 0, 0, 1284, 1287, 3, 184, 92, 0, 1285, 1287, 3, 196, 98, 0, 1286, 1284, 1, 0, 0, 0, 1286, 1285, 1, 0, 0, 0, 1287, 1289, 1, 0, 0, 0, 1288, 1278, 1, 0, 0, 0, 1288, 1282, 1, 0, 0, 0, 1288, 1289, 1, 0, 0, 0, 1289, 83, 1, 0, 0, 0, 1290, 1292, 3, 132, 66, 0, 1291, 1290, 1, 0, 0, 0, 1291, 1292, 1, 0, 0, 0, 1292, 1293, 1, 0, 0, 0, 1293, 1299, 3, 88, 44, 0, 1294, 1295, 3, 104, 52, 0, 1295, 1296, 3, 88, 44, 0, 1296, 1298, 1, 0, 0, 0, 1297, 1294, 1, 0, 0, 0, 1298, 1301, 1, 0, 0, 0, 1299, 1297, 1, 0, 0, 0, 1299, 1300, 1, 0, 0, 0, 1300, 1303, 1, 0, 0, 0, 1301, 1299, 1, 0, 0, 0, 1302, 1304, 3, 134, 67, 0, 1303, 1302, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1306, 1, 0, 0, 0, 1305, 1307, 3, 136, 68, 0, 1306, 1305, 1, 0, 0, 0, 1306, 1307, 1, 0, 0, 0, 1307, 85, 1, 0, 0, 0, 1308, 1316, 3, 96, 48, 0, 1309, 1310, 3, 100, 50, 0, 1310, 1312, 3, 96, 48, 0, 1311, 1313, 3, 102, 51, 0, 1312, 1311, 1, 0, 0, 0, 1312, 1313, 1, 0, 0, 0, 1313, 1315, 1, 0, 0, 0, 1314, 1309, 1, 0, 0, 0, 1315, 1318, 1, 0, 0, 0, 1316, 1314, 1, 0, 0, 0, 1316, 1317, 1, 0, 0, 0, 1317, 87, 1, 0, 0, 0, 1318, 1316, 1, 0, 0, 0, 1319, 1321, 5, 130, 0, 0, 1320, 1322, 7, 16, 0, 0, 1321, 1320, 1, 0, 0, 0, 1321, 1322, 1, 0, 0, 0, 1322, 1323, 1, 0, 0, 0, 1323, 1328, 3, 98, 49, 0, 1324, 1325, 5, 5, 0, 0, 1325, 1327, 3, 98, 49, 0, 1326, 1324, 1, 0, 0, 0, 1327, 1330, 1, 0, 0, 0, 1328, 1326, 1, 0, 0, 0, 1328, 1329, 1, 0, 0, 0, 1329, 1343, 1, 0, 0, 0, 1330, 1328, 1, 0, 0, 0, 1331, 1341, 5, 75, 0, 0, 1332, 1337, 3, 96, 48, 0, 1333, 1334, 5, 5, 0, 0, 1334, 1336, 3, 96, 48, 0, 1335, 1333, 1, 0, 0, 0, 1336, 1339, 1, 0, 0, 0, 1337, 1335, 1, 0, 0, 0, 1337, 1338, 1, 0, 0, 0, 1338, 1342, 1, 0, 0, 0, 1339, 1337, 1, 0, 0, 0, 1340, 1342, 3, 86, 43, 0, 1341, 1332, 1, 0, 0, 0, 1341, 1340, 1, 0, 0, 0, 1342, 1344, 1, 0, 0, 0, 1343, 1331, 1, 0, 0, 0, 1343, 1344, 1, 0, 0, 0, 1344, 1347, 1, 0, 0, 0, 1345, 1346, 5, 149, 0, 0, 1346, 1348, 3, 68, 34, 0, 1347, 1345, 1, 0, 0, 0, 1347, 1348, 1, 0, 0, 0, 1348, 1363, 1, 0, 0, 0, 1349, 1350, 5, 78, 0, 0, 1350, 1351, 5, 40, 0, 0, 1351, 1356, 3, 68, 34, 0, 1352, 1353, 5, 5, 0, 0, 1353, 1355, 3, 68, 34, 0, 1354, 1352, 1, 0, 0, 0, 1355, 1358, 1, 0, 0, 0, 1356, 1354, 1, 0, 0, 0, 1356, 1357, 1, 0, 0, 0, 1357, 1361, 1, 0, 0, 0, 1358, 1356, 1, 0, 0, 0, 1359, 1360, 5, 79, 0, 0, 1360, 1362, 3, 68, 34, 0, 1361, 1359, 1, 0, 0, 0, 1361, 1362, 1, 0, 0, 0, 1362, 1364, 1, 0, 0, 0, 1363, 1349, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, 1379, 1, 0, 0, 0, 1365, 1366, 5, 175, 0, 0, 1366, 1367, 3, 214, 107, 0, 1367, 1368, 5, 33, 0, 0, 1368, 1376, 3, 118, 59, 0, 1369, 1370, 5, 5, 0, 0, 1370, 1371, 3, 214, 107, 0, 1371, 1372, 5, 33, 0, 0, 1372, 1373, 3, 118, 59, 0, 1373, 1375, 1, 0, 0, 0, 1374, 1369, 1, 0, 0, 0, 1375, 1378, 1, 0, 0, 0, 1376, 1374, 1, 0, 0, 0, 1376, 1377, 1, 0, 0, 0, 1377, 1380, 1, 0, 0, 0, 1378, 1376, 1, 0, 0, 0, 1379, 1365, 1, 0, 0, 0, 1379, 1380, 1, 0, 0, 0, 1380, 1410, 1, 0, 0, 0, 1381, 1382, 5, 145, 0, 0, 1382, 1383, 5, 3, 0, 0, 1383, 1388, 3, 68, 34, 0, 1384, 1385, 5, 5, 0, 0, 1385, 1387, 3, 68, 34, 0, 1386, 1384, 1, 0, 0, 0, 1387, 1390, 1, 0, 0, 0, 1388, 1386, 1, 0, 0, 0, 1388, 1389, 1, 0, 0, 0, 1389, 1391, 1, 0, 0, 0, 1390, 1388, 1, 0, 0, 0, 1391, 1406, 5, 4, 0, 0, 1392, 1393, 5, 5, 0, 0, 1393, 1394, 5, 3, 0, 0, 1394, 1399, 3, 68, 34, 0, 1395, 1396, 5, 5, 0, 0, 1396, 1398, 3, 68, 34, 0, 1397, 1395, 1, 0, 0, 0, 1398, 1401, 1, 0, 0, 0, 1399, 1397, 1, 0, 0, 0, 1399, 1400, 1, 0, 0, 0, 1400, 1402, 1, 0, 0, 0, 1401, 1399, 1, 0, 0, 0, 1402, 1403, 5, 4, 0, 0, 1403, 1405, 1, 0, 0, 0, 1404, 1392, 1, 0, 0, 0, 1405, 1408, 1, 0, 0, 0, 1406, 1404, 1, 0, 0, 0, 1406, 1407, 1, 0, 0, 0, 1407, 1410, 1, 0, 0, 0, 1408, 1406, 1, 0, 0, 0, 1409, 1319, 1, 0, 0, 0, 1409, 1381, 1, 0, 0, 0, 1410, 89, 1, 0, 0, 0, 1411, 1412, 3, 84, 42, 0, 1412, 91, 1, 0, 0, 0, 1413, 1415, 3, 132, 66, 0, 1414, 1413, 1, 0, 0, 0, 1414, 1415, 1, 0, 0, 0, 1415, 1416, 1, 0, 0, 0, 1416, 1418, 3, 88, 44, 0, 1417, 1419, 3, 134, 67, 0, 1418, 1417, 1, 0, 0, 0, 1418, 1419, 1, 0, 0, 0, 1419, 1421, 1, 0, 0, 0, 1420, 1422, 3, 136, 68, 0, 1421, 1420, 1, 0, 0, 0, 1421, 1422, 1, 0, 0, 0, 1422, 93, 1, 0, 0, 0, 1423, 1425, 3, 132, 66, 0, 1424, 1423, 1, 0, 0, 0, 1424, 1425, 1, 0, 0, 0, 1425, 1426, 1, 0, 0, 0, 1426, 1436, 3, 88, 44, 0, 1427, 1429, 5, 140, 0, 0, 1428, 1430, 5, 29, 0, 0, 1429, 1428, 1, 0, 0, 0, 1429, 1430, 1, 0, 0, 0, 1430, 1434, 1, 0, 0, 0, 1431, 1434, 5, 90, 0, 0, 1432, 1434, 5, 68, 0, 0, 1433, 1427, 1, 0, 0, 0, 1433, 1431, 1, 0, 0, 0, 1433, 1432, 1, 0, 0, 0, 1434, 1435, 1, 0, 0, 0, 1435, 1437, 3, 88, 44, 0, 1436, 1433, 1, 0, 0, 0, 1437, 1438, 1, 0, 0, 0, 1438, 1436, 1, 0, 0, 0, 1438, 1439, 1, 0, 0, 0, 1439, 1441, 1, 0, 0, 0, 1440, 1442, 3, 134, 67, 0, 1441, 1440, 1, 0, 0, 0, 1441, 1442, 1, 0, 0, 0, 1442, 1444, 1, 0, 0, 0, 1443, 1445, 3, 136, 68, 0, 1444, 1443, 1, 0, 0, 0, 1444, 1445, 1, 0, 0, 0, 1445, 95, 1, 0, 0, 0, 1446, 1447, 3, 182, 91, 0, 1447, 1448, 5, 2, 0, 0, 1448, 1450, 1, 0, 0, 0, 1449, 1446, 1, 0, 0, 0, 1449, 1450, 1, 0, 0, 0, 1450, 1451, 1, 0, 0, 0, 1451, 1456, 3, 184, 92, 0, 1452, 1454, 5, 33, 0, 0, 1453, 1452, 1, 0, 0, 0, 1453, 1454, 1, 0, 0, 0, 1454, 1455, 1, 0, 0, 0, 1455, 1457, 3, 208, 104, 0, 1456, 1453, 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1463, 1, 0, 0, 0, 1458, 1459, 5, 85, 0, 0, 1459, 1460, 5, 40, 0, 0, 1460, 1464, 3, 196, 98, 0, 1461, 1462, 5, 102, 0, 0, 1462, 1464, 5, 85, 0, 0, 1463, 1458, 1, 0, 0, 0, 1463, 1461, 1, 0, 0, 0, 1463, 1464, 1, 0, 0, 0, 1464, 1575, 1, 0, 0, 0, 1465, 1466, 3, 182, 91, 0, 1466, 1467, 5, 2, 0, 0, 1467, 1469, 1, 0, 0, 0, 1468, 1465, 1, 0, 0, 0, 1468, 1469, 1, 0, 0, 0, 1469, 1470, 1, 0, 0, 0, 1470, 1471, 3, 226, 113, 0, 1471, 1472, 5, 3, 0, 0, 1472, 1477, 3, 68, 34, 0, 1473, 1474, 5, 5, 0, 0, 1474, 1476, 3, 68, 34, 0, 1475, 1473, 1, 0, 0, 0, 1476, 1479, 1, 0, 0, 0, 1477, 1475, 1, 0, 0, 0, 1477, 1478, 1, 0, 0, 0, 1478, 1480, 1, 0, 0, 0, 1479, 1477, 1, 0, 0, 0, 1480, 1485, 5, 4, 0, 0, 1481, 1483, 5, 33, 0, 0, 1482, 1481, 1, 0, 0, 0, 1482, 1483, 1, 0, 0, 0, 1483, 1484, 1, 0, 0, 0, 1484, 1486, 3, 208, 104, 0, 1485, 1482, 1, 0, 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 1575, 1, 0, 0, 0, 1487, 1497, 5, 3, 0, 0, 1488, 1493, 3, 96, 48, 0, 1489, 1490, 5, 5, 0, 0, 1490, 1492, 3, 96, 48, 0, 1491, 1489, 1, 0, 0, 0, 1492, 1495, 1, 0, 0, 0, 1493, 1491, 1, 0, 0, 0, 1493, 1494, 1, 0, 0, 0, 1494, 1498, 1, 0, 0, 0, 1495, 1493, 1, 0, 0, 0, 1496, 1498, 3, 86, 43, 0, 1497, 1488, 1, 0, 0, 0, 1497, 1496, 1, 0, 0, 0, 1498, 1499, 1, 0, 0, 0, 1499, 1500, 5, 4, 0, 0, 1500, 1575, 1, 0, 0, 0, 1501, 1502, 5, 3, 0, 0, 1502, 1503, 3, 84, 42, 0, 1503, 1508, 5, 4, 0, 0, 1504, 1506, 5, 33, 0, 0, 1505, 1504, 1, 0, 0, 0, 1505, 1506, 1, 0, 0, 0, 1506, 1507, 1, 0, 0, 0, 1507, 1509, 3, 208, 104, 0, 1508, 1505, 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1575, 1, 0, 0, 0, 1510, 1511, 3, 182, 91, 0, 1511, 1512, 5, 2, 0, 0, 1512, 1514, 1, 0, 0, 0, 1513, 1510, 1, 0, 0, 0, 1513, 1514, 1, 0, 0, 0, 1514, 1515, 1, 0, 0, 0, 1515, 1520, 3, 184, 92, 0, 1516, 1518, 5, 33, 0, 0, 1517, 1516, 1, 0, 0, 0, 1517, 1518, 1, 0, 0, 0, 1518, 1519, 1, 0, 0, 0, 1519, 1521, 3, 210, 105, 0, 1520, 1517, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1527, 1, 0, 0, 0, 1522, 1523, 5, 85, 0, 0, 1523, 1524, 5, 40, 0, 0, 1524, 1528, 3, 196, 98, 0, 1525, 1526, 5, 102, 0, 0, 1526, 1528, 5, 85, 0, 0, 1527, 1522, 1, 0, 0, 0, 1527, 1525, 1, 0, 0, 0, 1527, 1528, 1, 0, 0, 0, 1528, 1575, 1, 0, 0, 0, 1529, 1530, 3, 182, 91, 0, 1530, 1531, 5, 2, 0, 0, 1531, 1533, 1, 0, 0, 0, 1532, 1529, 1, 0, 0, 0, 1532, 1533, 1, 0, 0, 0, 1533, 1534, 1, 0, 0, 0, 1534, 1535, 3, 226, 113, 0, 1535, 1536, 5, 3, 0, 0, 1536, 1541, 3, 68, 34, 0, 1537, 1538, 5, 5, 0, 0, 1538, 1540, 3, 68, 34, 0, 1539, 1537, 1, 0, 0, 0, 1540, 1543, 1, 0, 0, 0, 1541, 1539, 1, 0, 0, 0, 1541, 1542, 1, 0, 0, 0, 1542, 1544, 1, 0, 0, 0, 1543, 1541, 1, 0, 0, 0, 1544, 1549, 5, 4, 0, 0, 1545, 1547, 5, 33, 0, 0, 1546, 1545, 1, 0, 0, 0, 1546, 1547, 1, 0, 0, 0, 1547, 1548, 1, 0, 0, 0, 1548, 1550, 3, 210, 105, 0, 1549, 1546, 1, 0, 0, 0, 1549, 1550, 1, 0, 0, 0, 1550, 1575, 1, 0, 0, 0, 1551, 1561, 5, 3, 0, 0, 1552, 1557, 3, 96, 48, 0, 1553, 1554, 5, 5, 0, 0, 1554, 1556, 3, 96, 48, 0, 1555, 1553, 1, 0, 0, 0, 1556, 1559, 1, 0, 0, 0, 1557, 1555, 1, 0, 0, 0, 1557, 1558, 1, 0, 0, 0, 1558, 1562, 1, 0, 0, 0, 1559, 1557, 1, 0, 0, 0, 1560, 1562, 3, 86, 43, 0, 1561, 1552, 1, 0, 0, 0, 1561, 1560, 1, 0, 0, 0, 1562, 1563, 1, 0, 0, 0, 1563, 1564, 5, 4, 0, 0, 1564, 1575, 1, 0, 0, 0, 1565, 1566, 5, 3, 0, 0, 1566, 1567, 3, 84, 42, 0, 1567, 1572, 5, 4, 0, 0, 1568, 1570, 5, 33, 0, 0, 1569, 1568, 1, 0, 0, 0, 1569, 1570, 1, 0, 0, 0, 1570, 1571, 1, 0, 0, 0, 1571, 1573, 3, 210, 105, 0, 1572, 1569, 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1575, 1, 0, 0, 0, 1574, 1449, 1, 0, 0, 0, 1574, 1468, 1, 0, 0, 0, 1574, 1487, 1, 0, 0, 0, 1574, 1501, 1, 0, 0, 0, 1574, 1513, 1, 0, 0, 0, 1574, 1532, 1, 0, 0, 0, 1574, 1551, 1, 0, 0, 0, 1574, 1565, 1, 0, 0, 0, 1575, 97, 1, 0, 0, 0, 1576, 1589, 5, 7, 0, 0, 1577, 1578, 3, 184, 92, 0, 1578, 1579, 5, 2, 0, 0, 1579, 1580, 5, 7, 0, 0, 1580, 1589, 1, 0, 0, 0, 1581, 1586, 3, 68, 34, 0, 1582, 1584, 5, 33, 0, 0, 1583, 1582, 1, 0, 0, 0, 1583, 1584, 1, 0, 0, 0, 1584, 1585, 1, 0, 0, 0, 1585, 1587, 3, 172, 86, 0, 1586, 1583, 1, 0, 0, 0, 1586, 1587, 1, 0, 0, 0, 1587, 1589, 1, 0, 0, 0, 1588, 1576, 1, 0, 0, 0, 1588, 1577, 1, 0, 0, 0, 1588, 1581, 1, 0, 0, 0, 1589, 99, 1, 0, 0, 0, 1590, 1605, 5, 5, 0, 0, 1591, 1593, 5, 100, 0, 0, 1592, 1591, 1, 0, 0, 0, 1592, 1593, 1, 0, 0, 0, 1593, 1599, 1, 0, 0, 0, 1594, 1596, 7, 17, 0, 0, 1595, 1597, 5, 110, 0, 0, 1596, 1595, 1, 0, 0, 0, 1596, 1597, 1, 0, 0, 0, 1597, 1600, 1, 0, 0, 0, 1598, 1600, 5, 87, 0, 0, 1599, 1594, 1, 0, 0, 0, 1599, 1598, 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1601, 1, 0, 0, 0, 1601, 1605, 5, 94, 0, 0, 1602, 1603, 5, 51, 0, 0, 1603, 1605, 5, 94, 0, 0, 1604, 1590, 1, 0, 0, 0, 1604, 1592, 1, 0, 0, 0, 1604, 1602, 1, 0, 0, 0, 1605, 101, 1, 0, 0, 0, 1606, 1607, 5, 107, 0, 0, 1607, 1621, 3, 68, 34, 0, 1608, 1609, 5, 143, 0, 0, 1609, 1610, 5, 3, 0, 0, 1610, 1615, 3, 190, 95, 0, 1611, 1612, 5, 5, 0, 0, 1612, 1614, 3, 190, 95, 0, 1613, 1611, 1, 0, 0, 0, 1614, 1617, 1, 0, 0, 0, 1615, 1613, 1, 0, 0, 0, 1615, 1616, 1, 0, 0, 0, 1616, 1618, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1618, 1619, 5, 4, 0, 0, 1619, 1621, 1, 0, 0, 0, 1620, 1606, 1, 0, 0, 0, 1620, 1608, 1, 0, 0, 0, 1621, 103, 1, 0, 0, 0, 1622, 1624, 5, 140, 0, 0, 1623, 1625, 5, 29, 0, 0, 1624, 1623, 1, 0, 0, 0, 1624, 1625, 1, 0, 0, 0, 1625, 1629, 1, 0, 0, 0, 1626, 1629, 5, 90, 0, 0, 1627, 1629, 5, 68, 0, 0, 1628, 1622, 1, 0, 0, 0, 1628, 1626, 1, 0, 0, 0, 1628, 1627, 1, 0, 0, 0, 1629, 105, 1, 0, 0, 0, 1630, 1632, 3, 50, 25, 0, 1631, 1630, 1, 0, 0, 0, 1631, 1632, 1, 0, 0, 0, 1632, 1633, 1, 0, 0, 0, 1633, 1636, 5, 142, 0, 0, 1634, 1635, 5, 108, 0, 0, 1635, 1637, 7, 8, 0, 0, 1636, 1634, 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1639, 3, 112, 56, 0, 1639, 1642, 5, 131, 0, 0, 1640, 1643, 3, 190, 95, 0, 1641, 1643, 3, 108, 54, 0, 1642, 1640, 1, 0, 0, 0, 1642, 1641, 1, 0, 0, 0, 1643, 1644, 1, 0, 0, 0, 1644, 1645, 5, 6, 0, 0, 1645, 1656, 3, 68, 34, 0, 1646, 1649, 5, 5, 0, 0, 1647, 1650, 3, 190, 95, 0, 1648, 1650, 3, 108, 54, 0, 1649, 1647, 1, 0, 0, 0, 1649, 1648, 1, 0, 0, 0, 1650, 1651, 1, 0, 0, 0, 1651, 1652, 5, 6, 0, 0, 1652, 1653, 3, 68, 34, 0, 1653, 1655, 1, 0, 0, 0, 1654, 1646, 1, 0, 0, 0, 1655, 1658, 1, 0, 0, 0, 1656, 1654, 1, 0, 0, 0, 1656, 1657, 1, 0, 0, 0, 1657, 1661, 1, 0, 0, 0, 1658, 1656, 1, 0, 0, 0, 1659, 1660, 5, 149, 0, 0, 1660, 1662, 3, 68, 34, 0, 1661, 1659, 1, 0, 0, 0, 1661, 1662, 1, 0, 0, 0, 1662, 1664, 1, 0, 0, 0, 1663, 1665, 3, 58, 29, 0, 1664, 1663, 1, 0, 0, 0, 1664, 1665, 1, 0, 0, 0, 1665, 107, 1, 0, 0, 0, 1666, 1667, 5, 3, 0, 0, 1667, 1672, 3, 190, 95, 0, 1668, 1669, 5, 5, 0, 0, 1669, 1671, 3, 190, 95, 0, 1670, 1668, 1, 0, 0, 0, 1671, 1674, 1, 0, 0, 0, 1672, 1670, 1, 0, 0, 0, 1672, 1673, 1, 0, 0, 0, 1673, 1675, 1, 0, 0, 0, 1674, 1672, 1, 0, 0, 0, 1675, 1676, 5, 4, 0, 0, 1676, 109, 1, 0, 0, 0, 1677, 1679, 3, 50, 25, 0, 1678, 1677, 1, 0, 0, 0, 1678, 1679, 1, 0, 0, 0, 1679, 1680, 1, 0, 0, 0, 1680, 1683, 5, 142, 0, 0, 1681, 1682, 5, 108, 0, 0, 1682, 1684, 7, 8, 0, 0, 1683, 1681, 1, 0, 0, 0, 1683, 1684, 1, 0, 0, 0, 1684, 1685, 1, 0, 0, 0, 1685, 1686, 3, 112, 56, 0, 1686, 1689, 5, 131, 0, 0, 1687, 1690, 3, 190, 95, 0, 1688, 1690, 3, 108, 54, 0, 1689, 1687, 1, 0, 0, 0, 1689, 1688, 1, 0, 0, 0, 1690, 1691, 1, 0, 0, 0, 1691, 1692, 5, 6, 0, 0, 1692, 1703, 3, 68, 34, 0, 1693, 1696, 5, 5, 0, 0, 1694, 1697, 3, 190, 95, 0, 1695, 1697, 3, 108, 54, 0, 1696, 1694, 1, 0, 0, 0, 1696, 1695, 1, 0, 0, 0, 1697, 1698, 1, 0, 0, 0, 1698, 1699, 5, 6, 0, 0, 1699, 1700, 3, 68, 34, 0, 1700, 1702, 1, 0, 0, 0, 1701, 1693, 1, 0, 0, 0, 1702, 1705, 1, 0, 0, 0, 1703, 1701, 1, 0, 0, 0, 1703, 1704, 1, 0, 0, 0, 1704, 1708, 1, 0, 0, 0, 1705, 1703, 1, 0, 0, 0, 1706, 1707, 5, 149, 0, 0, 1707, 1709, 3, 68, 34, 0, 1708, 1706, 1, 0, 0, 0, 1708, 1709, 1, 0, 0, 0, 1709, 1714, 1, 0, 0, 0, 1710, 1712, 3, 134, 67, 0, 1711, 1710, 1, 0, 0, 0, 1711, 1712, 1, 0, 0, 0, 1712, 1713, 1, 0, 0, 0, 1713, 1715, 3, 136, 68, 0, 1714, 1711, 1, 0, 0, 0, 1714, 1715, 1, 0, 0, 0, 1715, 111, 1, 0, 0, 0, 1716, 1717, 3, 182, 91, 0, 1717, 1718, 5, 2, 0, 0, 1718, 1720, 1, 0, 0, 0, 1719, 1716, 1, 0, 0, 0, 1719, 1720, 1, 0, 0, 0, 1720, 1721, 1, 0, 0, 0, 1721, 1724, 3, 184, 92, 0, 1722, 1723, 5, 33, 0, 0, 1723, 1725, 3, 216, 108, 0, 1724, 1722, 1, 0, 0, 0, 1724, 1725, 1, 0, 0, 0, 1725, 1731, 1, 0, 0, 0, 1726, 1727, 5, 85, 0, 0, 1727, 1728, 5, 40, 0, 0, 1728, 1732, 3, 196, 98, 0, 1729, 1730, 5, 102, 0, 0, 1730, 1732, 5, 85, 0, 0, 1731, 1726, 1, 0, 0, 0, 1731, 1729, 1, 0, 0, 0, 1731, 1732, 1, 0, 0, 0, 1732, 113, 1, 0, 0, 0, 1733, 1735, 5, 144, 0, 0, 1734, 1736, 3, 182, 91, 0, 1735, 1734, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, 0, 1736, 1739, 1, 0, 0, 0, 1737, 1738, 5, 91, 0, 0, 1738, 1740, 3, 218, 109, 0, 1739, 1737, 1, 0, 0, 0, 1739, 1740, 1, 0, 0, 0, 1740, 115, 1, 0, 0, 0, 1741, 1742, 5, 179, 0, 0, 1742, 1743, 5, 3, 0, 0, 1743, 1744, 5, 149, 0, 0, 1744, 1745, 3, 68, 34, 0, 1745, 1746, 5, 4, 0, 0, 1746, 117, 1, 0, 0, 0, 1747, 1749, 5, 3, 0, 0, 1748, 1750, 3, 220, 110, 0, 1749, 1748, 1, 0, 0, 0, 1749, 1750, 1, 0, 0, 0, 1750, 1761, 1, 0, 0, 0, 1751, 1752, 5, 154, 0, 0, 1752, 1753, 5, 40, 0, 0, 1753, 1758, 3, 68, 34, 0, 1754, 1755, 5, 5, 0, 0, 1755, 1757, 3, 68, 34, 0, 1756, 1754, 1, 0, 0, 0, 1757, 1760, 1, 0, 0, 0, 1758, 1756, 1, 0, 0, 0, 1758, 1759, 1, 0, 0, 0, 1759, 1762, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1761, 1751, 1, 0, 0, 0, 1761, 1762, 1, 0, 0, 0, 1762, 1763, 1, 0, 0, 0, 1763, 1764, 5, 109, 0, 0, 1764, 1765, 5, 40, 0, 0, 1765, 1770, 3, 138, 69, 0, 1766, 1767, 5, 5, 0, 0, 1767, 1769, 3, 138, 69, 0, 1768, 1766, 1, 0, 0, 0, 1769, 1772, 1, 0, 0, 0, 1770, 1768, 1, 0, 0, 0, 1770, 1771, 1, 0, 0, 0, 1771, 1774, 1, 0, 0, 0, 1772, 1770, 1, 0, 0, 0, 1773, 1775, 3, 122, 61, 0, 1774, 1773, 1, 0, 0, 0, 1774, 1775, 1, 0, 0, 0, 1775, 1776, 1, 0, 0, 0, 1776, 1777, 5, 4, 0, 0, 1777, 119, 1, 0, 0, 0, 1778, 1812, 5, 153, 0, 0, 1779, 1813, 3, 214, 107, 0, 1780, 1782, 5, 3, 0, 0, 1781, 1783, 3, 220, 110, 0, 1782, 1781, 1, 0, 0, 0, 1782, 1783, 1, 0, 0, 0, 1783, 1794, 1, 0, 0, 0, 1784, 1785, 5, 154, 0, 0, 1785, 1786, 5, 40, 0, 0, 1786, 1791, 3, 68, 34, 0, 1787, 1788, 5, 5, 0, 0, 1788, 1790, 3, 68, 34, 0, 1789, 1787, 1, 0, 0, 0, 1790, 1793, 1, 0, 0, 0, 1791, 1789, 1, 0, 0, 0, 1791, 1792, 1, 0, 0, 0, 1792, 1795, 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1794, 1784, 1, 0, 0, 0, 1794, 1795, 1, 0, 0, 0, 1795, 1806, 1, 0, 0, 0, 1796, 1797, 5, 109, 0, 0, 1797, 1798, 5, 40, 0, 0, 1798, 1803, 3, 138, 69, 0, 1799, 1800, 5, 5, 0, 0, 1800, 1802, 3, 138, 69, 0, 1801, 1799, 1, 0, 0, 0, 1802, 1805, 1, 0, 0, 0, 1803, 1801, 1, 0, 0, 0, 1803, 1804, 1, 0, 0, 0, 1804, 1807, 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1806, 1796, 1, 0, 0, 0, 1806, 1807, 1, 0, 0, 0, 1807, 1809, 1, 0, 0, 0, 1808, 1810, 3, 122, 61, 0, 1809, 1808, 1, 0, 0, 0, 1809, 1810, 1, 0, 0, 0, 1810, 1811, 1, 0, 0, 0, 1811, 1813, 5, 4, 0, 0, 1812, 1779, 1, 0, 0, 0, 1812, 1780, 1, 0, 0, 0, 1813, 121, 1, 0, 0, 0, 1814, 1822, 3, 124, 62, 0, 1815, 1816, 5, 181, 0, 0, 1816, 1817, 5, 101, 0, 0, 1817, 1823, 5, 183, 0, 0, 1818, 1819, 5, 158, 0, 0, 1819, 1823, 5, 127, 0, 0, 1820, 1823, 5, 78, 0, 0, 1821, 1823, 5, 182, 0, 0, 1822, 1815, 1, 0, 0, 0, 1822, 1818, 1, 0, 0, 0, 1822, 1820, 1, 0, 0, 0, 1822, 1821, 1, 0, 0, 0, 1822, 1823, 1, 0, 0, 0, 1823, 123, 1, 0, 0, 0, 1824, 1831, 7, 18, 0, 0, 1825, 1832, 3, 146, 73, 0, 1826, 1827, 5, 39, 0, 0, 1827, 1828, 3, 142, 71, 0, 1828, 1829, 5, 32, 0, 0, 1829, 1830, 3, 144, 72, 0, 1830, 1832, 1, 0, 0, 0, 1831, 1825, 1, 0, 0, 0, 1831, 1826, 1, 0, 0, 0, 1832, 125, 1, 0, 0, 0, 1833, 1834, 3, 222, 111, 0, 1834, 1844, 5, 3, 0, 0, 1835, 1840, 3, 68, 34, 0, 1836, 1837, 5, 5, 0, 0, 1837, 1839, 3, 68, 34, 0, 1838, 1836, 1, 0, 0, 0, 1839, 1842, 1, 0, 0, 0, 1840, 1838, 1, 0, 0, 0, 1840, 1841, 1, 0, 0, 0, 1841, 1845, 1, 0, 0, 0, 1842, 1840, 1, 0, 0, 0, 1843, 1845, 5, 7, 0, 0, 1844, 1835, 1, 0, 0, 0, 1844, 1843, 1, 0, 0, 0, 1845, 1846, 1, 0, 0, 0, 1846, 1847, 5, 4, 0, 0, 1847, 127, 1, 0, 0, 0, 1848, 1849, 3, 224, 112, 0, 1849, 1862, 5, 3, 0, 0, 1850, 1852, 5, 62, 0, 0, 1851, 1850, 1, 0, 0, 0, 1851, 1852, 1, 0, 0, 0, 1852, 1853, 1, 0, 0, 0, 1853, 1858, 3, 68, 34, 0, 1854, 1855, 5, 5, 0, 0, 1855, 1857, 3, 68, 34, 0, 1856, 1854, 1, 0, 0, 0, 1857, 1860, 1, 0, 0, 0, 1858, 1856, 1, 0, 0, 0, 1858, 1859, 1, 0, 0, 0, 1859, 1863, 1, 0, 0, 0, 1860, 1858, 1, 0, 0, 0, 1861, 1863, 5, 7, 0, 0, 1862, 1851, 1, 0, 0, 0, 1862, 1861, 1, 0, 0, 0, 1862, 1863, 1, 0, 0, 0, 1863, 1864, 1, 0, 0, 0, 1864, 1866, 5, 4, 0, 0, 1865, 1867, 3, 116, 58, 0, 1866, 1865, 1, 0, 0, 0, 1866, 1867, 1, 0, 0, 0, 1867, 129, 1, 0, 0, 0, 1868, 1869, 3, 148, 74, 0, 1869, 1879, 5, 3, 0, 0, 1870, 1875, 3, 68, 34, 0, 1871, 1872, 5, 5, 0, 0, 1872, 1874, 3, 68, 34, 0, 1873, 1871, 1, 0, 0, 0, 1874, 1877, 1, 0, 0, 0, 1875, 1873, 1, 0, 0, 0, 1875, 1876, 1, 0, 0, 0, 1876, 1880, 1, 0, 0, 0, 1877, 1875, 1, 0, 0, 0, 1878, 1880, 5, 7, 0, 0, 1879, 1870, 1, 0, 0, 0, 1879, 1878, 1, 0, 0, 0, 1879, 1880, 1, 0, 0, 0, 1880, 1881, 1, 0, 0, 0, 1881, 1883, 5, 4, 0, 0, 1882, 1884, 3, 116, 58, 0, 1883, 1882, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, 1885, 1, 0, 0, 0, 1885, 1888, 5, 153, 0, 0, 1886, 1889, 3, 118, 59, 0, 1887, 1889, 3, 214, 107, 0, 1888, 1886, 1, 0, 0, 0, 1888, 1887, 1, 0, 0, 0, 1889, 131, 1, 0, 0, 0, 1890, 1892, 5, 150, 0, 0, 1891, 1893, 5, 116, 0, 0, 1892, 1891, 1, 0, 0, 0, 1892, 1893, 1, 0, 0, 0, 1893, 1894, 1, 0, 0, 0, 1894, 1899, 3, 56, 28, 0, 1895, 1896, 5, 5, 0, 0, 1896, 1898, 3, 56, 28, 0, 1897, 1895, 1, 0, 0, 0, 1898, 1901, 1, 0, 0, 0, 1899, 1897, 1, 0, 0, 0, 1899, 1900, 1, 0, 0, 0, 1900, 133, 1, 0, 0, 0, 1901, 1899, 1, 0, 0, 0, 1902, 1903, 5, 109, 0, 0, 1903, 1904, 5, 40, 0, 0, 1904, 1909, 3, 138, 69, 0, 1905, 1906, 5, 5, 0, 0, 1906, 1908, 3, 138, 69, 0, 1907, 1905, 1, 0, 0, 0, 1908, 1911, 1, 0, 0, 0, 1909, 1907, 1, 0, 0, 0, 1909, 1910, 1, 0, 0, 0, 1910, 135, 1, 0, 0, 0, 1911, 1909, 1, 0, 0, 0, 1912, 1913, 5, 98, 0, 0, 1913, 1916, 3, 68, 34, 0, 1914, 1915, 7, 19, 0, 0, 1915, 1917, 3, 68, 34, 0, 1916, 1914, 1, 0, 0, 0, 1916, 1917, 1, 0, 0, 0, 1917, 137, 1, 0, 0, 0, 1918, 1921, 3, 68, 34, 0, 1919, 1920, 5, 45, 0, 0, 1920, 1922, 3, 192, 96, 0, 1921, 1919, 1, 0, 0, 0, 1921, 1922, 1, 0, 0, 0, 1922, 1924, 1, 0, 0, 0, 1923, 1925, 3, 140, 70, 0, 1924, 1923, 1, 0, 0, 0, 1924, 1925, 1, 0, 0, 0, 1925, 1928, 1, 0, 0, 0, 1926, 1927, 5, 176, 0, 0, 1927, 1929, 7, 20, 0, 0, 1928, 1926, 1, 0, 0, 0, 1928, 1929, 1, 0, 0, 0, 1929, 139, 1, 0, 0, 0, 1930, 1931, 7, 21, 0, 0, 1931, 141, 1, 0, 0, 0, 1932, 1933, 3, 68, 34, 0, 1933, 1934, 5, 156, 0, 0, 1934, 1943, 1, 0, 0, 0, 1935, 1936, 3, 68, 34, 0, 1936, 1937, 5, 159, 0, 0, 1937, 1943, 1, 0, 0, 0, 1938, 1939, 5, 158, 0, 0, 1939, 1943, 5, 127, 0, 0, 1940, 1941, 5, 157, 0, 0, 1941, 1943, 5, 156, 0, 0, 1942, 1932, 1, 0, 0, 0, 1942, 1935, 1, 0, 0, 0, 1942, 1938, 1, 0, 0, 0, 1942, 1940, 1, 0, 0, 0, 1943, 143, 1, 0, 0, 0, 1944, 1945, 3, 68, 34, 0, 1945, 1946, 5, 156, 0, 0, 1946, 1955, 1, 0, 0, 0, 1947, 1948, 3, 68, 34, 0, 1948, 1949, 5, 159, 0, 0, 1949, 1955, 1, 0, 0, 0, 1950, 1951, 5, 158, 0, 0, 1951, 1955, 5, 127, 0, 0, 1952, 1953, 5, 157, 0, 0, 1953, 1955, 5, 159, 0, 0, 1954, 1944, 1, 0, 0, 0, 1954, 1947, 1, 0, 0, 0, 1954, 1950, 1, 0, 0, 0, 1954, 1952, 1, 0, 0, 0, 1955, 145, 1, 0, 0, 0, 1956, 1957, 3, 68, 34, 0, 1957, 1958, 5, 156, 0, 0, 1958, 1964, 1, 0, 0, 0, 1959, 1960, 5, 157, 0, 0, 1960, 1964, 5, 156, 0, 0, 1961, 1962, 5, 158, 0, 0, 1962, 1964, 5, 127, 0, 0, 1963, 1956, 1, 0, 0, 0, 1963, 1959, 1, 0, 0, 0, 1963, 1961, 1, 0, 0, 0, 1964, 147, 1, 0, 0, 0, 1965, 1966, 7, 22, 0, 0, 1966, 1967, 5, 3, 0, 0, 1967, 1968, 3, 68, 34, 0, 1968, 1969, 5, 4, 0, 0, 1969, 1970, 5, 153, 0, 0, 1970, 1972, 5, 3, 0, 0, 1971, 1973, 3, 154, 77, 0, 1972, 1971, 1, 0, 0, 0, 1972, 1973, 1, 0, 0, 0, 1973, 1974, 1, 0, 0, 0, 1974, 1976, 3, 158, 79, 0, 1975, 1977, 3, 124, 62, 0, 1976, 1975, 1, 0, 0, 0, 1976, 1977, 1, 0, 0, 0, 1977, 1978, 1, 0, 0, 0, 1978, 1979, 5, 4, 0, 0, 1979, 2051, 1, 0, 0, 0, 1980, 1981, 7, 23, 0, 0, 1981, 1982, 5, 3, 0, 0, 1982, 1983, 5, 4, 0, 0, 1983, 1984, 5, 153, 0, 0, 1984, 1986, 5, 3, 0, 0, 1985, 1987, 3, 154, 77, 0, 1986, 1985, 1, 0, 0, 0, 1986, 1987, 1, 0, 0, 0, 1987, 1989, 1, 0, 0, 0, 1988, 1990, 3, 156, 78, 0, 1989, 1988, 1, 0, 0, 0, 1989, 1990, 1, 0, 0, 0, 1990, 1991, 1, 0, 0, 0, 1991, 2051, 5, 4, 0, 0, 1992, 1993, 7, 24, 0, 0, 1993, 1994, 5, 3, 0, 0, 1994, 1995, 5, 4, 0, 0, 1995, 1996, 5, 153, 0, 0, 1996, 1998, 5, 3, 0, 0, 1997, 1999, 3, 154, 77, 0, 1998, 1997, 1, 0, 0, 0, 1998, 1999, 1, 0, 0, 0, 1999, 2000, 1, 0, 0, 0, 2000, 2001, 3, 158, 79, 0, 2001, 2002, 5, 4, 0, 0, 2002, 2051, 1, 0, 0, 0, 2003, 2004, 7, 25, 0, 0, 2004, 2005, 5, 3, 0, 0, 2005, 2007, 3, 68, 34, 0, 2006, 2008, 3, 150, 75, 0, 2007, 2006, 1, 0, 0, 0, 2007, 2008, 1, 0, 0, 0, 2008, 2010, 1, 0, 0, 0, 2009, 2011, 3, 152, 76, 0, 2010, 2009, 1, 0, 0, 0, 2010, 2011, 1, 0, 0, 0, 2011, 2012, 1, 0, 0, 0, 2012, 2013, 5, 4, 0, 0, 2013, 2014, 5, 153, 0, 0, 2014, 2016, 5, 3, 0, 0, 2015, 2017, 3, 154, 77, 0, 2016, 2015, 1, 0, 0, 0, 2016, 2017, 1, 0, 0, 0, 2017, 2018, 1, 0, 0, 0, 2018, 2019, 3, 158, 79, 0, 2019, 2020, 5, 4, 0, 0, 2020, 2051, 1, 0, 0, 0, 2021, 2022, 5, 165, 0, 0, 2022, 2023, 5, 3, 0, 0, 2023, 2024, 3, 68, 34, 0, 2024, 2025, 5, 5, 0, 0, 2025, 2026, 3, 36, 18, 0, 2026, 2027, 5, 4, 0, 0, 2027, 2028, 5, 153, 0, 0, 2028, 2030, 5, 3, 0, 0, 2029, 2031, 3, 154, 77, 0, 2030, 2029, 1, 0, 0, 0, 2030, 2031, 1, 0, 0, 0, 2031, 2032, 1, 0, 0, 0, 2032, 2034, 3, 158, 79, 0, 2033, 2035, 3, 124, 62, 0, 2034, 2033, 1, 0, 0, 0, 2034, 2035, 1, 0, 0, 0, 2035, 2036, 1, 0, 0, 0, 2036, 2037, 5, 4, 0, 0, 2037, 2051, 1, 0, 0, 0, 2038, 2039, 5, 166, 0, 0, 2039, 2040, 5, 3, 0, 0, 2040, 2041, 3, 68, 34, 0, 2041, 2042, 5, 4, 0, 0, 2042, 2043, 5, 153, 0, 0, 2043, 2045, 5, 3, 0, 0, 2044, 2046, 3, 154, 77, 0, 2045, 2044, 1, 0, 0, 0, 2045, 2046, 1, 0, 0, 0, 2046, 2047, 1, 0, 0, 0, 2047, 2048, 3, 158, 79, 0, 2048, 2049, 5, 4, 0, 0, 2049, 2051, 1, 0, 0, 0, 2050, 1965, 1, 0, 0, 0, 2050, 1980, 1, 0, 0, 0, 2050, 1992, 1, 0, 0, 0, 2050, 2003, 1, 0, 0, 0, 2050, 2021, 1, 0, 0, 0, 2050, 2038, 1, 0, 0, 0, 2051, 149, 1, 0, 0, 0, 2052, 2053, 5, 5, 0, 0, 2053, 2054, 3, 36, 18, 0, 2054, 151, 1, 0, 0, 0, 2055, 2056, 5, 5, 0, 0, 2056, 2057, 3, 36, 18, 0, 2057, 153, 1, 0, 0, 0, 2058, 2059, 5, 154, 0, 0, 2059, 2061, 5, 40, 0, 0, 2060, 2062, 3, 68, 34, 0, 2061, 2060, 1, 0, 0, 0, 2062, 2063, 1, 0, 0, 0, 2063, 2061, 1, 0, 0, 0, 2063, 2064, 1, 0, 0, 0, 2064, 155, 1, 0, 0, 0, 2065, 2066, 5, 109, 0, 0, 2066, 2068, 5, 40, 0, 0, 2067, 2069, 3, 68, 34, 0, 2068, 2067, 1, 0, 0, 0, 2069, 2070, 1, 0, 0, 0, 2070, 2068, 1, 0, 0, 0, 2070, 2071, 1, 0, 0, 0, 2071, 157, 1, 0, 0, 0, 2072, 2073, 5, 109, 0, 0, 2073, 2074, 5, 40, 0, 0, 2074, 2075, 3, 158, 79, 0, 2075, 159, 1, 0, 0, 0, 2076, 2078, 3, 68, 34, 0, 2077, 2079, 3, 140, 70, 0, 2078, 2077, 1, 0, 0, 0, 2078, 2079, 1, 0, 0, 0, 2079, 2087, 1, 0, 0, 0, 2080, 2081, 5, 5, 0, 0, 2081, 2083, 3, 68, 34, 0, 2082, 2084, 3, 140, 70, 0, 2083, 2082, 1, 0, 0, 0, 2083, 2084, 1, 0, 0, 0, 2084, 2086, 1, 0, 0, 0, 2085, 2080, 1, 0, 0, 0, 2086, 2089, 1, 0, 0, 0, 2087, 2085, 1, 0, 0, 0, 2087, 2088, 1, 0, 0, 0, 2088, 161, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, 2090, 2091, 3, 84, 42, 0, 2091, 163, 1, 0, 0, 0, 2092, 2093, 3, 84, 42, 0, 2093, 165, 1, 0, 0, 0, 2094, 2095, 7, 26, 0, 0, 2095, 167, 1, 0, 0, 0, 2096, 2097, 5, 190, 0, 0, 2097, 169, 1, 0, 0, 0, 2098, 2101, 3, 68, 34, 0, 2099, 2101, 3, 30, 15, 0, 2100, 2098, 1, 0, 0, 0, 2100, 2099, 1, 0, 0, 0, 2101, 171, 1, 0, 0, 0, 2102, 2103, 7, 27, 0, 0, 2103, 173, 1, 0, 0, 0, 2104, 2105, 7, 28, 0, 0, 2105, 175, 1, 0, 0, 0, 2106, 2107, 3, 228, 114, 0, 2107, 177, 1, 0, 0, 0, 2108, 2109, 3, 228, 114, 0, 2109, 179, 1, 0, 0, 0, 2110, 2111, 3, 182, 91, 0, 2111, 2112, 5, 2, 0, 0, 2112, 2114, 1, 0, 0, 0, 2113, 2110, 1, 0, 0, 0, 2113, 2114, 1, 0, 0, 0, 2114, 2115, 1, 0, 0, 0, 2115, 2116, 3, 178, 89, 0, 2116, 181, 1, 0, 0, 0, 2117, 2118, 3, 228, 114, 0, 2118, 183, 1, 0, 0, 0, 2119, 2120, 3, 228, 114, 0, 2120, 185, 1, 0, 0, 0, 2121, 2122, 3, 228, 114, 0, 2122, 187, 1, 0, 0, 0, 2123, 2124, 3, 228, 114, 0, 2124, 189, 1, 0, 0, 0, 2125, 2126, 3, 228, 114, 0, 2126, 191, 1, 0, 0, 0, 2127, 2128, 3, 228, 114, 0, 2128, 193, 1, 0, 0, 0, 2129, 2130, 3, 228, 114, 0, 2130, 195, 1, 0, 0, 0, 2131, 2132, 3, 228, 114, 0, 2132, 197, 1, 0, 0, 0, 2133, 2134, 3, 228, 114, 0, 2134, 199, 1, 0, 0, 0, 2135, 2136, 3, 228, 114, 0, 2136, 201, 1, 0, 0, 0, 2137, 2138, 3, 228, 114, 0, 2138, 203, 1, 0, 0, 0, 2139, 2140, 3, 228, 114, 0, 2140, 205, 1, 0, 0, 0, 2141, 2142, 3, 228, 114, 0, 2142, 207, 1, 0, 0, 0, 2143, 2144, 7, 27, 0, 0, 2144, 209, 1, 0, 0, 0, 2145, 2146, 3, 228, 114, 0, 2146, 211, 1, 0, 0, 0, 2147, 2148, 3, 228, 114, 0, 2148, 213, 1, 0, 0, 0, 2149, 2150, 3, 228, 114, 0, 2150, 215, 1, 0, 0, 0, 2151, 2152, 3, 228, 114, 0, 2152, 217, 1, 0, 0, 0, 2153, 2154, 3, 228, 114, 0, 2154, 219, 1, 0, 0, 0, 2155, 2156, 3, 228, 114, 0, 2156, 221, 1, 0, 0, 0, 2157, 2158, 3, 228, 114, 0, 2158, 223, 1, 0, 0, 0, 2159, 2160, 3, 228, 114, 0, 2160, 225, 1, 0, 0, 0, 2161, 2162, 3, 228, 114, 0, 2162, 227, 1, 0, 0, 0, 2163, 2171, 5, 186, 0, 0, 2164, 2171, 3, 174, 87, 0, 2165, 2171, 5, 190, 0, 0, 2166, 2167, 5, 3, 0, 0, 2167, 2168, 3, 228, 114, 0, 2168, 2169, 5, 4, 0, 0, 2169, 2171, 1, 0, 0, 0, 2170, 2163, 1, 0, 0, 0, 2170, 2164, 1, 0, 0, 0, 2170, 2165, 1, 0, 0, 0, 2170, 2166, 1, 0, 0, 0, 2171, 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, 1035, 1046, 1055, 1065, 1068, 1074, 1080, 1089, 1092, 1096, 1103, 1109, 1116, 1118, 1120, 1129, 1136, 1143, 1149, 1154, 1162, 1167, 1176, 1187, 1194, 1198, 1201, 1204, 1208, 1218, 1224, 1226, 1234, 1241, 1248, 1253, 1255, 1261, 1270, 1275, 1282, 1286, 1288, 1291, 1299, 1303, 1306, 1312, 1316, 1321, 1328, 1337, 1341, 1343, 1347, 1356, 1361, 1363, 1376, 1379, 1388, 1399, 1406, 1409, 1414, 1418, 1421, 1424, 1429, 1433, 1438, 1441, 1444, 1449, 1453, 1456, 1463, 1468, 1477, 1482, 1485, 1493, 1497, 1505, 1508, 1513, 1517, 1520, 1527, 1532, 1541, 1546, 1549, 1557, 1561, 1569, 1572, 1574, 1583, 1586, 1588, 1592, 1596, 1599, 1604, 1615, 1620, 1624, 1628, 1631, 1636, 1642, 1649, 1656, 1661, 1664, 1672, 1678, 1683, 1689, 1696, 1703, 1708, 1711, 1714, 1719, 1724, 1731, 1735, 1739, 1749, 1758, 1761, 1770, 1774, 1782, 1791, 1794, 1803, 1806, 1809, 1812, 1822, 1831, 1840, 1844, 1851, 1858, 1862, 1866, 1875, 1879, 1883, 1888, 1892, 1899, 1909, 1916, 1921, 1924, 1928, 1942, 1954, 1963, 1972, 1976, 1986, 1989, 1998, 2007, 2010, 2016, 2030, 2034, 2045, 2050, 2063, 2070, 2078, 2083, 2087, 2100, 2113, 2170] \ No newline at end of file +[4, 1, 197, 2178, 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, 3, 37, 1205, 8, 37, 1, 37, 3, 37, 1208, 8, 37, 1, 37, 3, 37, 1211, 8, 37, 1, 37, 1, 37, 3, 37, 1215, 8, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1223, 8, 38, 10, 38, 12, 38, 1226, 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1231, 8, 38, 3, 38, 1233, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1241, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1248, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1253, 8, 38, 10, 38, 12, 38, 1256, 9, 38, 1, 38, 1, 38, 3, 38, 1260, 8, 38, 3, 38, 1262, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1268, 8, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1277, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 1282, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1289, 8, 41, 1, 41, 1, 41, 3, 41, 1293, 8, 41, 3, 41, 1295, 8, 41, 1, 42, 3, 42, 1298, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1304, 8, 42, 10, 42, 12, 42, 1307, 9, 42, 1, 42, 3, 42, 1310, 8, 42, 1, 42, 3, 42, 1313, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 1320, 8, 43, 10, 43, 12, 43, 1323, 9, 43, 1, 44, 1, 44, 3, 44, 1327, 8, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1332, 8, 44, 10, 44, 12, 44, 1335, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1341, 8, 44, 10, 44, 12, 44, 1344, 9, 44, 1, 44, 3, 44, 1347, 8, 44, 3, 44, 1349, 8, 44, 1, 44, 1, 44, 3, 44, 1353, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1360, 8, 44, 10, 44, 12, 44, 1363, 9, 44, 1, 44, 1, 44, 3, 44, 1367, 8, 44, 3, 44, 1369, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1380, 8, 44, 10, 44, 12, 44, 1383, 9, 44, 3, 44, 1385, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1392, 8, 44, 10, 44, 12, 44, 1395, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1403, 8, 44, 10, 44, 12, 44, 1406, 9, 44, 1, 44, 1, 44, 5, 44, 1410, 8, 44, 10, 44, 12, 44, 1413, 9, 44, 3, 44, 1415, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1420, 8, 46, 1, 46, 1, 46, 3, 46, 1424, 8, 46, 1, 46, 3, 46, 1427, 8, 46, 1, 47, 3, 47, 1430, 8, 47, 1, 47, 1, 47, 1, 47, 3, 47, 1435, 8, 47, 1, 47, 1, 47, 3, 47, 1439, 8, 47, 1, 47, 4, 47, 1442, 8, 47, 11, 47, 12, 47, 1443, 1, 47, 3, 47, 1447, 8, 47, 1, 47, 3, 47, 1450, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1455, 8, 48, 1, 48, 1, 48, 3, 48, 1459, 8, 48, 1, 48, 3, 48, 1462, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1469, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1474, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1481, 8, 48, 10, 48, 12, 48, 1484, 9, 48, 1, 48, 1, 48, 3, 48, 1488, 8, 48, 1, 48, 3, 48, 1491, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1497, 8, 48, 10, 48, 12, 48, 1500, 9, 48, 1, 48, 3, 48, 1503, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1511, 8, 48, 1, 48, 3, 48, 1514, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1519, 8, 48, 1, 48, 1, 48, 3, 48, 1523, 8, 48, 1, 48, 3, 48, 1526, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1533, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1538, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1545, 8, 48, 10, 48, 12, 48, 1548, 9, 48, 1, 48, 1, 48, 3, 48, 1552, 8, 48, 1, 48, 3, 48, 1555, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1561, 8, 48, 10, 48, 12, 48, 1564, 9, 48, 1, 48, 3, 48, 1567, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1575, 8, 48, 1, 48, 3, 48, 1578, 8, 48, 3, 48, 1580, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 3, 49, 1589, 8, 49, 1, 49, 3, 49, 1592, 8, 49, 3, 49, 1594, 8, 49, 1, 50, 1, 50, 3, 50, 1598, 8, 50, 1, 50, 1, 50, 3, 50, 1602, 8, 50, 1, 50, 3, 50, 1605, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1610, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1619, 8, 51, 10, 51, 12, 51, 1622, 9, 51, 1, 51, 1, 51, 3, 51, 1626, 8, 51, 1, 52, 1, 52, 3, 52, 1630, 8, 52, 1, 52, 1, 52, 3, 52, 1634, 8, 52, 1, 53, 3, 53, 1637, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1642, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1648, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1655, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1660, 8, 53, 10, 53, 12, 53, 1663, 9, 53, 1, 53, 1, 53, 3, 53, 1667, 8, 53, 1, 53, 3, 53, 1670, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1676, 8, 54, 10, 54, 12, 54, 1679, 9, 54, 1, 54, 1, 54, 1, 55, 3, 55, 1684, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1689, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1695, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1702, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1707, 8, 55, 10, 55, 12, 55, 1710, 9, 55, 1, 55, 1, 55, 3, 55, 1714, 8, 55, 1, 55, 3, 55, 1717, 8, 55, 1, 55, 3, 55, 1720, 8, 55, 1, 56, 1, 56, 1, 56, 3, 56, 1725, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1730, 8, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1737, 8, 56, 1, 57, 1, 57, 3, 57, 1741, 8, 57, 1, 57, 1, 57, 3, 57, 1745, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1755, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1762, 8, 59, 10, 59, 12, 59, 1765, 9, 59, 3, 59, 1767, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1774, 8, 59, 10, 59, 12, 59, 1777, 9, 59, 1, 59, 3, 59, 1780, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 3, 60, 1788, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1795, 8, 60, 10, 60, 12, 60, 1798, 9, 60, 3, 60, 1800, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1807, 8, 60, 10, 60, 12, 60, 1810, 9, 60, 3, 60, 1812, 8, 60, 1, 60, 3, 60, 1815, 8, 60, 1, 60, 3, 60, 1818, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1828, 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1837, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1844, 8, 63, 10, 63, 12, 63, 1847, 9, 63, 1, 63, 3, 63, 1850, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1857, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1862, 8, 64, 10, 64, 12, 64, 1865, 9, 64, 1, 64, 3, 64, 1868, 8, 64, 1, 64, 1, 64, 3, 64, 1872, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1879, 8, 65, 10, 65, 12, 65, 1882, 9, 65, 1, 65, 3, 65, 1885, 8, 65, 1, 65, 1, 65, 3, 65, 1889, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1894, 8, 65, 1, 66, 1, 66, 3, 66, 1898, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1903, 8, 66, 10, 66, 12, 66, 1906, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1913, 8, 67, 10, 67, 12, 67, 1916, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1922, 8, 68, 1, 69, 1, 69, 1, 69, 3, 69, 1927, 8, 69, 1, 69, 3, 69, 1930, 8, 69, 1, 69, 1, 69, 3, 69, 1934, 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, 1948, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1960, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1969, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1978, 8, 74, 1, 74, 1, 74, 3, 74, 1982, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1992, 8, 74, 1, 74, 3, 74, 1995, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2004, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2013, 8, 74, 1, 74, 3, 74, 2016, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2022, 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, 2036, 8, 74, 1, 74, 1, 74, 3, 74, 2040, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2051, 8, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2056, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 4, 77, 2067, 8, 77, 11, 77, 12, 77, 2068, 1, 78, 1, 78, 1, 78, 4, 78, 2074, 8, 78, 11, 78, 12, 78, 2075, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 2084, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, 2089, 8, 80, 5, 80, 2091, 8, 80, 10, 80, 12, 80, 2094, 9, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2106, 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, 2119, 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, 2176, 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, 2484, 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, 1214, 1, 0, 0, 0, 76, 1216, 1, 0, 0, 0, 78, 1263, 1, 0, 0, 0, 80, 1281, 1, 0, 0, 0, 82, 1283, 1, 0, 0, 0, 84, 1297, 1, 0, 0, 0, 86, 1314, 1, 0, 0, 0, 88, 1414, 1, 0, 0, 0, 90, 1416, 1, 0, 0, 0, 92, 1419, 1, 0, 0, 0, 94, 1429, 1, 0, 0, 0, 96, 1579, 1, 0, 0, 0, 98, 1593, 1, 0, 0, 0, 100, 1609, 1, 0, 0, 0, 102, 1625, 1, 0, 0, 0, 104, 1633, 1, 0, 0, 0, 106, 1636, 1, 0, 0, 0, 108, 1671, 1, 0, 0, 0, 110, 1683, 1, 0, 0, 0, 112, 1724, 1, 0, 0, 0, 114, 1738, 1, 0, 0, 0, 116, 1746, 1, 0, 0, 0, 118, 1752, 1, 0, 0, 0, 120, 1783, 1, 0, 0, 0, 122, 1819, 1, 0, 0, 0, 124, 1829, 1, 0, 0, 0, 126, 1838, 1, 0, 0, 0, 128, 1853, 1, 0, 0, 0, 130, 1873, 1, 0, 0, 0, 132, 1895, 1, 0, 0, 0, 134, 1907, 1, 0, 0, 0, 136, 1917, 1, 0, 0, 0, 138, 1923, 1, 0, 0, 0, 140, 1935, 1, 0, 0, 0, 142, 1947, 1, 0, 0, 0, 144, 1959, 1, 0, 0, 0, 146, 1968, 1, 0, 0, 0, 148, 2055, 1, 0, 0, 0, 150, 2057, 1, 0, 0, 0, 152, 2060, 1, 0, 0, 0, 154, 2063, 1, 0, 0, 0, 156, 2070, 1, 0, 0, 0, 158, 2077, 1, 0, 0, 0, 160, 2081, 1, 0, 0, 0, 162, 2095, 1, 0, 0, 0, 164, 2097, 1, 0, 0, 0, 166, 2099, 1, 0, 0, 0, 168, 2101, 1, 0, 0, 0, 170, 2105, 1, 0, 0, 0, 172, 2107, 1, 0, 0, 0, 174, 2109, 1, 0, 0, 0, 176, 2111, 1, 0, 0, 0, 178, 2113, 1, 0, 0, 0, 180, 2118, 1, 0, 0, 0, 182, 2122, 1, 0, 0, 0, 184, 2124, 1, 0, 0, 0, 186, 2126, 1, 0, 0, 0, 188, 2128, 1, 0, 0, 0, 190, 2130, 1, 0, 0, 0, 192, 2132, 1, 0, 0, 0, 194, 2134, 1, 0, 0, 0, 196, 2136, 1, 0, 0, 0, 198, 2138, 1, 0, 0, 0, 200, 2140, 1, 0, 0, 0, 202, 2142, 1, 0, 0, 0, 204, 2144, 1, 0, 0, 0, 206, 2146, 1, 0, 0, 0, 208, 2148, 1, 0, 0, 0, 210, 2150, 1, 0, 0, 0, 212, 2152, 1, 0, 0, 0, 214, 2154, 1, 0, 0, 0, 216, 2156, 1, 0, 0, 0, 218, 2158, 1, 0, 0, 0, 220, 2160, 1, 0, 0, 0, 222, 2162, 1, 0, 0, 0, 224, 2164, 1, 0, 0, 0, 226, 2166, 1, 0, 0, 0, 228, 2175, 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, 1204, 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, 1205, 1, 0, 0, 0, 1202, 1200, 1, 0, 0, 0, 1203, 1205, 3, 84, 42, 0, 1204, 1175, 1, 0, 0, 0, 1204, 1203, 1, 0, 0, 0, 1205, 1207, 1, 0, 0, 0, 1206, 1208, 3, 76, 38, 0, 1207, 1206, 1, 0, 0, 0, 1207, 1208, 1, 0, 0, 0, 1208, 1210, 1, 0, 0, 0, 1209, 1211, 3, 58, 29, 0, 1210, 1209, 1, 0, 0, 0, 1210, 1211, 1, 0, 0, 0, 1211, 1215, 1, 0, 0, 0, 1212, 1213, 5, 58, 0, 0, 1213, 1215, 5, 147, 0, 0, 1214, 1142, 1, 0, 0, 0, 1214, 1212, 1, 0, 0, 0, 1215, 75, 1, 0, 0, 0, 1216, 1217, 5, 109, 0, 0, 1217, 1232, 5, 50, 0, 0, 1218, 1219, 5, 3, 0, 0, 1219, 1224, 3, 24, 12, 0, 1220, 1221, 5, 5, 0, 0, 1221, 1223, 3, 24, 12, 0, 1222, 1220, 1, 0, 0, 0, 1223, 1226, 1, 0, 0, 0, 1224, 1222, 1, 0, 0, 0, 1224, 1225, 1, 0, 0, 0, 1225, 1227, 1, 0, 0, 0, 1226, 1224, 1, 0, 0, 0, 1227, 1230, 5, 4, 0, 0, 1228, 1229, 5, 151, 0, 0, 1229, 1231, 3, 68, 34, 0, 1230, 1228, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1233, 1, 0, 0, 0, 1232, 1218, 1, 0, 0, 0, 1232, 1233, 1, 0, 0, 0, 1233, 1234, 1, 0, 0, 0, 1234, 1261, 5, 186, 0, 0, 1235, 1262, 5, 187, 0, 0, 1236, 1237, 5, 144, 0, 0, 1237, 1240, 5, 133, 0, 0, 1238, 1241, 3, 190, 95, 0, 1239, 1241, 3, 108, 54, 0, 1240, 1238, 1, 0, 0, 0, 1240, 1239, 1, 0, 0, 0, 1241, 1242, 1, 0, 0, 0, 1242, 1243, 5, 6, 0, 0, 1243, 1254, 3, 68, 34, 0, 1244, 1247, 5, 5, 0, 0, 1245, 1248, 3, 190, 95, 0, 1246, 1248, 3, 108, 54, 0, 1247, 1245, 1, 0, 0, 0, 1247, 1246, 1, 0, 0, 0, 1248, 1249, 1, 0, 0, 0, 1249, 1250, 5, 6, 0, 0, 1250, 1251, 3, 68, 34, 0, 1251, 1253, 1, 0, 0, 0, 1252, 1244, 1, 0, 0, 0, 1253, 1256, 1, 0, 0, 0, 1254, 1252, 1, 0, 0, 0, 1254, 1255, 1, 0, 0, 0, 1255, 1259, 1, 0, 0, 0, 1256, 1254, 1, 0, 0, 0, 1257, 1258, 5, 151, 0, 0, 1258, 1260, 3, 68, 34, 0, 1259, 1257, 1, 0, 0, 0, 1259, 1260, 1, 0, 0, 0, 1260, 1262, 1, 0, 0, 0, 1261, 1235, 1, 0, 0, 0, 1261, 1236, 1, 0, 0, 0, 1262, 77, 1, 0, 0, 0, 1263, 1267, 5, 114, 0, 0, 1264, 1265, 3, 182, 91, 0, 1265, 1266, 5, 2, 0, 0, 1266, 1268, 1, 0, 0, 0, 1267, 1264, 1, 0, 0, 0, 1267, 1268, 1, 0, 0, 0, 1268, 1269, 1, 0, 0, 0, 1269, 1276, 3, 204, 102, 0, 1270, 1271, 5, 6, 0, 0, 1271, 1277, 3, 80, 40, 0, 1272, 1273, 5, 3, 0, 0, 1273, 1274, 3, 80, 40, 0, 1274, 1275, 5, 4, 0, 0, 1275, 1277, 1, 0, 0, 0, 1276, 1270, 1, 0, 0, 0, 1276, 1272, 1, 0, 0, 0, 1276, 1277, 1, 0, 0, 0, 1277, 79, 1, 0, 0, 0, 1278, 1282, 3, 36, 18, 0, 1279, 1282, 3, 176, 88, 0, 1280, 1282, 5, 192, 0, 0, 1281, 1278, 1, 0, 0, 0, 1281, 1279, 1, 0, 0, 0, 1281, 1280, 1, 0, 0, 0, 1282, 81, 1, 0, 0, 0, 1283, 1294, 5, 121, 0, 0, 1284, 1295, 3, 192, 96, 0, 1285, 1286, 3, 182, 91, 0, 1286, 1287, 5, 2, 0, 0, 1287, 1289, 1, 0, 0, 0, 1288, 1285, 1, 0, 0, 0, 1288, 1289, 1, 0, 0, 0, 1289, 1292, 1, 0, 0, 0, 1290, 1293, 3, 184, 92, 0, 1291, 1293, 3, 196, 98, 0, 1292, 1290, 1, 0, 0, 0, 1292, 1291, 1, 0, 0, 0, 1293, 1295, 1, 0, 0, 0, 1294, 1284, 1, 0, 0, 0, 1294, 1288, 1, 0, 0, 0, 1294, 1295, 1, 0, 0, 0, 1295, 83, 1, 0, 0, 0, 1296, 1298, 3, 132, 66, 0, 1297, 1296, 1, 0, 0, 0, 1297, 1298, 1, 0, 0, 0, 1298, 1299, 1, 0, 0, 0, 1299, 1305, 3, 88, 44, 0, 1300, 1301, 3, 104, 52, 0, 1301, 1302, 3, 88, 44, 0, 1302, 1304, 1, 0, 0, 0, 1303, 1300, 1, 0, 0, 0, 1304, 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1305, 1306, 1, 0, 0, 0, 1306, 1309, 1, 0, 0, 0, 1307, 1305, 1, 0, 0, 0, 1308, 1310, 3, 134, 67, 0, 1309, 1308, 1, 0, 0, 0, 1309, 1310, 1, 0, 0, 0, 1310, 1312, 1, 0, 0, 0, 1311, 1313, 3, 136, 68, 0, 1312, 1311, 1, 0, 0, 0, 1312, 1313, 1, 0, 0, 0, 1313, 85, 1, 0, 0, 0, 1314, 1321, 3, 96, 48, 0, 1315, 1316, 3, 100, 50, 0, 1316, 1317, 3, 96, 48, 0, 1317, 1318, 3, 102, 51, 0, 1318, 1320, 1, 0, 0, 0, 1319, 1315, 1, 0, 0, 0, 1320, 1323, 1, 0, 0, 0, 1321, 1319, 1, 0, 0, 0, 1321, 1322, 1, 0, 0, 0, 1322, 87, 1, 0, 0, 0, 1323, 1321, 1, 0, 0, 0, 1324, 1326, 5, 132, 0, 0, 1325, 1327, 7, 17, 0, 0, 1326, 1325, 1, 0, 0, 0, 1326, 1327, 1, 0, 0, 0, 1327, 1328, 1, 0, 0, 0, 1328, 1333, 3, 98, 49, 0, 1329, 1330, 5, 5, 0, 0, 1330, 1332, 3, 98, 49, 0, 1331, 1329, 1, 0, 0, 0, 1332, 1335, 1, 0, 0, 0, 1333, 1331, 1, 0, 0, 0, 1333, 1334, 1, 0, 0, 0, 1334, 1348, 1, 0, 0, 0, 1335, 1333, 1, 0, 0, 0, 1336, 1346, 5, 77, 0, 0, 1337, 1342, 3, 96, 48, 0, 1338, 1339, 5, 5, 0, 0, 1339, 1341, 3, 96, 48, 0, 1340, 1338, 1, 0, 0, 0, 1341, 1344, 1, 0, 0, 0, 1342, 1340, 1, 0, 0, 0, 1342, 1343, 1, 0, 0, 0, 1343, 1347, 1, 0, 0, 0, 1344, 1342, 1, 0, 0, 0, 1345, 1347, 3, 86, 43, 0, 1346, 1337, 1, 0, 0, 0, 1346, 1345, 1, 0, 0, 0, 1347, 1349, 1, 0, 0, 0, 1348, 1336, 1, 0, 0, 0, 1348, 1349, 1, 0, 0, 0, 1349, 1352, 1, 0, 0, 0, 1350, 1351, 5, 151, 0, 0, 1351, 1353, 3, 68, 34, 0, 1352, 1350, 1, 0, 0, 0, 1352, 1353, 1, 0, 0, 0, 1353, 1368, 1, 0, 0, 0, 1354, 1355, 5, 80, 0, 0, 1355, 1356, 5, 42, 0, 0, 1356, 1361, 3, 68, 34, 0, 1357, 1358, 5, 5, 0, 0, 1358, 1360, 3, 68, 34, 0, 1359, 1357, 1, 0, 0, 0, 1360, 1363, 1, 0, 0, 0, 1361, 1359, 1, 0, 0, 0, 1361, 1362, 1, 0, 0, 0, 1362, 1366, 1, 0, 0, 0, 1363, 1361, 1, 0, 0, 0, 1364, 1365, 5, 81, 0, 0, 1365, 1367, 3, 68, 34, 0, 1366, 1364, 1, 0, 0, 0, 1366, 1367, 1, 0, 0, 0, 1367, 1369, 1, 0, 0, 0, 1368, 1354, 1, 0, 0, 0, 1368, 1369, 1, 0, 0, 0, 1369, 1384, 1, 0, 0, 0, 1370, 1371, 5, 177, 0, 0, 1371, 1372, 3, 214, 107, 0, 1372, 1373, 5, 35, 0, 0, 1373, 1381, 3, 118, 59, 0, 1374, 1375, 5, 5, 0, 0, 1375, 1376, 3, 214, 107, 0, 1376, 1377, 5, 35, 0, 0, 1377, 1378, 3, 118, 59, 0, 1378, 1380, 1, 0, 0, 0, 1379, 1374, 1, 0, 0, 0, 1380, 1383, 1, 0, 0, 0, 1381, 1379, 1, 0, 0, 0, 1381, 1382, 1, 0, 0, 0, 1382, 1385, 1, 0, 0, 0, 1383, 1381, 1, 0, 0, 0, 1384, 1370, 1, 0, 0, 0, 1384, 1385, 1, 0, 0, 0, 1385, 1415, 1, 0, 0, 0, 1386, 1387, 5, 147, 0, 0, 1387, 1388, 5, 3, 0, 0, 1388, 1393, 3, 68, 34, 0, 1389, 1390, 5, 5, 0, 0, 1390, 1392, 3, 68, 34, 0, 1391, 1389, 1, 0, 0, 0, 1392, 1395, 1, 0, 0, 0, 1393, 1391, 1, 0, 0, 0, 1393, 1394, 1, 0, 0, 0, 1394, 1396, 1, 0, 0, 0, 1395, 1393, 1, 0, 0, 0, 1396, 1411, 5, 4, 0, 0, 1397, 1398, 5, 5, 0, 0, 1398, 1399, 5, 3, 0, 0, 1399, 1404, 3, 68, 34, 0, 1400, 1401, 5, 5, 0, 0, 1401, 1403, 3, 68, 34, 0, 1402, 1400, 1, 0, 0, 0, 1403, 1406, 1, 0, 0, 0, 1404, 1402, 1, 0, 0, 0, 1404, 1405, 1, 0, 0, 0, 1405, 1407, 1, 0, 0, 0, 1406, 1404, 1, 0, 0, 0, 1407, 1408, 5, 4, 0, 0, 1408, 1410, 1, 0, 0, 0, 1409, 1397, 1, 0, 0, 0, 1410, 1413, 1, 0, 0, 0, 1411, 1409, 1, 0, 0, 0, 1411, 1412, 1, 0, 0, 0, 1412, 1415, 1, 0, 0, 0, 1413, 1411, 1, 0, 0, 0, 1414, 1324, 1, 0, 0, 0, 1414, 1386, 1, 0, 0, 0, 1415, 89, 1, 0, 0, 0, 1416, 1417, 3, 84, 42, 0, 1417, 91, 1, 0, 0, 0, 1418, 1420, 3, 132, 66, 0, 1419, 1418, 1, 0, 0, 0, 1419, 1420, 1, 0, 0, 0, 1420, 1421, 1, 0, 0, 0, 1421, 1423, 3, 88, 44, 0, 1422, 1424, 3, 134, 67, 0, 1423, 1422, 1, 0, 0, 0, 1423, 1424, 1, 0, 0, 0, 1424, 1426, 1, 0, 0, 0, 1425, 1427, 3, 136, 68, 0, 1426, 1425, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 93, 1, 0, 0, 0, 1428, 1430, 3, 132, 66, 0, 1429, 1428, 1, 0, 0, 0, 1429, 1430, 1, 0, 0, 0, 1430, 1431, 1, 0, 0, 0, 1431, 1441, 3, 88, 44, 0, 1432, 1434, 5, 142, 0, 0, 1433, 1435, 5, 31, 0, 0, 1434, 1433, 1, 0, 0, 0, 1434, 1435, 1, 0, 0, 0, 1435, 1439, 1, 0, 0, 0, 1436, 1439, 5, 92, 0, 0, 1437, 1439, 5, 70, 0, 0, 1438, 1432, 1, 0, 0, 0, 1438, 1436, 1, 0, 0, 0, 1438, 1437, 1, 0, 0, 0, 1439, 1440, 1, 0, 0, 0, 1440, 1442, 3, 88, 44, 0, 1441, 1438, 1, 0, 0, 0, 1442, 1443, 1, 0, 0, 0, 1443, 1441, 1, 0, 0, 0, 1443, 1444, 1, 0, 0, 0, 1444, 1446, 1, 0, 0, 0, 1445, 1447, 3, 134, 67, 0, 1446, 1445, 1, 0, 0, 0, 1446, 1447, 1, 0, 0, 0, 1447, 1449, 1, 0, 0, 0, 1448, 1450, 3, 136, 68, 0, 1449, 1448, 1, 0, 0, 0, 1449, 1450, 1, 0, 0, 0, 1450, 95, 1, 0, 0, 0, 1451, 1452, 3, 182, 91, 0, 1452, 1453, 5, 2, 0, 0, 1453, 1455, 1, 0, 0, 0, 1454, 1451, 1, 0, 0, 0, 1454, 1455, 1, 0, 0, 0, 1455, 1456, 1, 0, 0, 0, 1456, 1461, 3, 184, 92, 0, 1457, 1459, 5, 35, 0, 0, 1458, 1457, 1, 0, 0, 0, 1458, 1459, 1, 0, 0, 0, 1459, 1460, 1, 0, 0, 0, 1460, 1462, 3, 208, 104, 0, 1461, 1458, 1, 0, 0, 0, 1461, 1462, 1, 0, 0, 0, 1462, 1468, 1, 0, 0, 0, 1463, 1464, 5, 87, 0, 0, 1464, 1465, 5, 42, 0, 0, 1465, 1469, 3, 196, 98, 0, 1466, 1467, 5, 104, 0, 0, 1467, 1469, 5, 87, 0, 0, 1468, 1463, 1, 0, 0, 0, 1468, 1466, 1, 0, 0, 0, 1468, 1469, 1, 0, 0, 0, 1469, 1580, 1, 0, 0, 0, 1470, 1471, 3, 182, 91, 0, 1471, 1472, 5, 2, 0, 0, 1472, 1474, 1, 0, 0, 0, 1473, 1470, 1, 0, 0, 0, 1473, 1474, 1, 0, 0, 0, 1474, 1475, 1, 0, 0, 0, 1475, 1476, 3, 226, 113, 0, 1476, 1477, 5, 3, 0, 0, 1477, 1482, 3, 68, 34, 0, 1478, 1479, 5, 5, 0, 0, 1479, 1481, 3, 68, 34, 0, 1480, 1478, 1, 0, 0, 0, 1481, 1484, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1482, 1483, 1, 0, 0, 0, 1483, 1485, 1, 0, 0, 0, 1484, 1482, 1, 0, 0, 0, 1485, 1490, 5, 4, 0, 0, 1486, 1488, 5, 35, 0, 0, 1487, 1486, 1, 0, 0, 0, 1487, 1488, 1, 0, 0, 0, 1488, 1489, 1, 0, 0, 0, 1489, 1491, 3, 208, 104, 0, 1490, 1487, 1, 0, 0, 0, 1490, 1491, 1, 0, 0, 0, 1491, 1580, 1, 0, 0, 0, 1492, 1502, 5, 3, 0, 0, 1493, 1498, 3, 96, 48, 0, 1494, 1495, 5, 5, 0, 0, 1495, 1497, 3, 96, 48, 0, 1496, 1494, 1, 0, 0, 0, 1497, 1500, 1, 0, 0, 0, 1498, 1496, 1, 0, 0, 0, 1498, 1499, 1, 0, 0, 0, 1499, 1503, 1, 0, 0, 0, 1500, 1498, 1, 0, 0, 0, 1501, 1503, 3, 86, 43, 0, 1502, 1493, 1, 0, 0, 0, 1502, 1501, 1, 0, 0, 0, 1503, 1504, 1, 0, 0, 0, 1504, 1505, 5, 4, 0, 0, 1505, 1580, 1, 0, 0, 0, 1506, 1507, 5, 3, 0, 0, 1507, 1508, 3, 84, 42, 0, 1508, 1513, 5, 4, 0, 0, 1509, 1511, 5, 35, 0, 0, 1510, 1509, 1, 0, 0, 0, 1510, 1511, 1, 0, 0, 0, 1511, 1512, 1, 0, 0, 0, 1512, 1514, 3, 208, 104, 0, 1513, 1510, 1, 0, 0, 0, 1513, 1514, 1, 0, 0, 0, 1514, 1580, 1, 0, 0, 0, 1515, 1516, 3, 182, 91, 0, 1516, 1517, 5, 2, 0, 0, 1517, 1519, 1, 0, 0, 0, 1518, 1515, 1, 0, 0, 0, 1518, 1519, 1, 0, 0, 0, 1519, 1520, 1, 0, 0, 0, 1520, 1525, 3, 184, 92, 0, 1521, 1523, 5, 35, 0, 0, 1522, 1521, 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1524, 1, 0, 0, 0, 1524, 1526, 3, 210, 105, 0, 1525, 1522, 1, 0, 0, 0, 1525, 1526, 1, 0, 0, 0, 1526, 1532, 1, 0, 0, 0, 1527, 1528, 5, 87, 0, 0, 1528, 1529, 5, 42, 0, 0, 1529, 1533, 3, 196, 98, 0, 1530, 1531, 5, 104, 0, 0, 1531, 1533, 5, 87, 0, 0, 1532, 1527, 1, 0, 0, 0, 1532, 1530, 1, 0, 0, 0, 1532, 1533, 1, 0, 0, 0, 1533, 1580, 1, 0, 0, 0, 1534, 1535, 3, 182, 91, 0, 1535, 1536, 5, 2, 0, 0, 1536, 1538, 1, 0, 0, 0, 1537, 1534, 1, 0, 0, 0, 1537, 1538, 1, 0, 0, 0, 1538, 1539, 1, 0, 0, 0, 1539, 1540, 3, 226, 113, 0, 1540, 1541, 5, 3, 0, 0, 1541, 1546, 3, 68, 34, 0, 1542, 1543, 5, 5, 0, 0, 1543, 1545, 3, 68, 34, 0, 1544, 1542, 1, 0, 0, 0, 1545, 1548, 1, 0, 0, 0, 1546, 1544, 1, 0, 0, 0, 1546, 1547, 1, 0, 0, 0, 1547, 1549, 1, 0, 0, 0, 1548, 1546, 1, 0, 0, 0, 1549, 1554, 5, 4, 0, 0, 1550, 1552, 5, 35, 0, 0, 1551, 1550, 1, 0, 0, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1553, 1, 0, 0, 0, 1553, 1555, 3, 210, 105, 0, 1554, 1551, 1, 0, 0, 0, 1554, 1555, 1, 0, 0, 0, 1555, 1580, 1, 0, 0, 0, 1556, 1566, 5, 3, 0, 0, 1557, 1562, 3, 96, 48, 0, 1558, 1559, 5, 5, 0, 0, 1559, 1561, 3, 96, 48, 0, 1560, 1558, 1, 0, 0, 0, 1561, 1564, 1, 0, 0, 0, 1562, 1560, 1, 0, 0, 0, 1562, 1563, 1, 0, 0, 0, 1563, 1567, 1, 0, 0, 0, 1564, 1562, 1, 0, 0, 0, 1565, 1567, 3, 86, 43, 0, 1566, 1557, 1, 0, 0, 0, 1566, 1565, 1, 0, 0, 0, 1567, 1568, 1, 0, 0, 0, 1568, 1569, 5, 4, 0, 0, 1569, 1580, 1, 0, 0, 0, 1570, 1571, 5, 3, 0, 0, 1571, 1572, 3, 84, 42, 0, 1572, 1577, 5, 4, 0, 0, 1573, 1575, 5, 35, 0, 0, 1574, 1573, 1, 0, 0, 0, 1574, 1575, 1, 0, 0, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1578, 3, 210, 105, 0, 1577, 1574, 1, 0, 0, 0, 1577, 1578, 1, 0, 0, 0, 1578, 1580, 1, 0, 0, 0, 1579, 1454, 1, 0, 0, 0, 1579, 1473, 1, 0, 0, 0, 1579, 1492, 1, 0, 0, 0, 1579, 1506, 1, 0, 0, 0, 1579, 1518, 1, 0, 0, 0, 1579, 1537, 1, 0, 0, 0, 1579, 1556, 1, 0, 0, 0, 1579, 1570, 1, 0, 0, 0, 1580, 97, 1, 0, 0, 0, 1581, 1594, 5, 7, 0, 0, 1582, 1583, 3, 184, 92, 0, 1583, 1584, 5, 2, 0, 0, 1584, 1585, 5, 7, 0, 0, 1585, 1594, 1, 0, 0, 0, 1586, 1591, 3, 68, 34, 0, 1587, 1589, 5, 35, 0, 0, 1588, 1587, 1, 0, 0, 0, 1588, 1589, 1, 0, 0, 0, 1589, 1590, 1, 0, 0, 0, 1590, 1592, 3, 172, 86, 0, 1591, 1588, 1, 0, 0, 0, 1591, 1592, 1, 0, 0, 0, 1592, 1594, 1, 0, 0, 0, 1593, 1581, 1, 0, 0, 0, 1593, 1582, 1, 0, 0, 0, 1593, 1586, 1, 0, 0, 0, 1594, 99, 1, 0, 0, 0, 1595, 1610, 5, 5, 0, 0, 1596, 1598, 5, 102, 0, 0, 1597, 1596, 1, 0, 0, 0, 1597, 1598, 1, 0, 0, 0, 1598, 1604, 1, 0, 0, 0, 1599, 1601, 7, 18, 0, 0, 1600, 1602, 5, 112, 0, 0, 1601, 1600, 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1605, 1, 0, 0, 0, 1603, 1605, 5, 89, 0, 0, 1604, 1599, 1, 0, 0, 0, 1604, 1603, 1, 0, 0, 0, 1604, 1605, 1, 0, 0, 0, 1605, 1606, 1, 0, 0, 0, 1606, 1610, 5, 96, 0, 0, 1607, 1608, 5, 53, 0, 0, 1608, 1610, 5, 96, 0, 0, 1609, 1595, 1, 0, 0, 0, 1609, 1597, 1, 0, 0, 0, 1609, 1607, 1, 0, 0, 0, 1610, 101, 1, 0, 0, 0, 1611, 1612, 5, 109, 0, 0, 1612, 1626, 3, 68, 34, 0, 1613, 1614, 5, 145, 0, 0, 1614, 1615, 5, 3, 0, 0, 1615, 1620, 3, 190, 95, 0, 1616, 1617, 5, 5, 0, 0, 1617, 1619, 3, 190, 95, 0, 1618, 1616, 1, 0, 0, 0, 1619, 1622, 1, 0, 0, 0, 1620, 1618, 1, 0, 0, 0, 1620, 1621, 1, 0, 0, 0, 1621, 1623, 1, 0, 0, 0, 1622, 1620, 1, 0, 0, 0, 1623, 1624, 5, 4, 0, 0, 1624, 1626, 1, 0, 0, 0, 1625, 1611, 1, 0, 0, 0, 1625, 1613, 1, 0, 0, 0, 1625, 1626, 1, 0, 0, 0, 1626, 103, 1, 0, 0, 0, 1627, 1629, 5, 142, 0, 0, 1628, 1630, 5, 31, 0, 0, 1629, 1628, 1, 0, 0, 0, 1629, 1630, 1, 0, 0, 0, 1630, 1634, 1, 0, 0, 0, 1631, 1634, 5, 92, 0, 0, 1632, 1634, 5, 70, 0, 0, 1633, 1627, 1, 0, 0, 0, 1633, 1631, 1, 0, 0, 0, 1633, 1632, 1, 0, 0, 0, 1634, 105, 1, 0, 0, 0, 1635, 1637, 3, 50, 25, 0, 1636, 1635, 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1641, 5, 144, 0, 0, 1639, 1640, 5, 110, 0, 0, 1640, 1642, 7, 8, 0, 0, 1641, 1639, 1, 0, 0, 0, 1641, 1642, 1, 0, 0, 0, 1642, 1643, 1, 0, 0, 0, 1643, 1644, 3, 112, 56, 0, 1644, 1647, 5, 133, 0, 0, 1645, 1648, 3, 190, 95, 0, 1646, 1648, 3, 108, 54, 0, 1647, 1645, 1, 0, 0, 0, 1647, 1646, 1, 0, 0, 0, 1648, 1649, 1, 0, 0, 0, 1649, 1650, 5, 6, 0, 0, 1650, 1661, 3, 68, 34, 0, 1651, 1654, 5, 5, 0, 0, 1652, 1655, 3, 190, 95, 0, 1653, 1655, 3, 108, 54, 0, 1654, 1652, 1, 0, 0, 0, 1654, 1653, 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1657, 5, 6, 0, 0, 1657, 1658, 3, 68, 34, 0, 1658, 1660, 1, 0, 0, 0, 1659, 1651, 1, 0, 0, 0, 1660, 1663, 1, 0, 0, 0, 1661, 1659, 1, 0, 0, 0, 1661, 1662, 1, 0, 0, 0, 1662, 1666, 1, 0, 0, 0, 1663, 1661, 1, 0, 0, 0, 1664, 1665, 5, 151, 0, 0, 1665, 1667, 3, 68, 34, 0, 1666, 1664, 1, 0, 0, 0, 1666, 1667, 1, 0, 0, 0, 1667, 1669, 1, 0, 0, 0, 1668, 1670, 3, 58, 29, 0, 1669, 1668, 1, 0, 0, 0, 1669, 1670, 1, 0, 0, 0, 1670, 107, 1, 0, 0, 0, 1671, 1672, 5, 3, 0, 0, 1672, 1677, 3, 190, 95, 0, 1673, 1674, 5, 5, 0, 0, 1674, 1676, 3, 190, 95, 0, 1675, 1673, 1, 0, 0, 0, 1676, 1679, 1, 0, 0, 0, 1677, 1675, 1, 0, 0, 0, 1677, 1678, 1, 0, 0, 0, 1678, 1680, 1, 0, 0, 0, 1679, 1677, 1, 0, 0, 0, 1680, 1681, 5, 4, 0, 0, 1681, 109, 1, 0, 0, 0, 1682, 1684, 3, 50, 25, 0, 1683, 1682, 1, 0, 0, 0, 1683, 1684, 1, 0, 0, 0, 1684, 1685, 1, 0, 0, 0, 1685, 1688, 5, 144, 0, 0, 1686, 1687, 5, 110, 0, 0, 1687, 1689, 7, 8, 0, 0, 1688, 1686, 1, 0, 0, 0, 1688, 1689, 1, 0, 0, 0, 1689, 1690, 1, 0, 0, 0, 1690, 1691, 3, 112, 56, 0, 1691, 1694, 5, 133, 0, 0, 1692, 1695, 3, 190, 95, 0, 1693, 1695, 3, 108, 54, 0, 1694, 1692, 1, 0, 0, 0, 1694, 1693, 1, 0, 0, 0, 1695, 1696, 1, 0, 0, 0, 1696, 1697, 5, 6, 0, 0, 1697, 1708, 3, 68, 34, 0, 1698, 1701, 5, 5, 0, 0, 1699, 1702, 3, 190, 95, 0, 1700, 1702, 3, 108, 54, 0, 1701, 1699, 1, 0, 0, 0, 1701, 1700, 1, 0, 0, 0, 1702, 1703, 1, 0, 0, 0, 1703, 1704, 5, 6, 0, 0, 1704, 1705, 3, 68, 34, 0, 1705, 1707, 1, 0, 0, 0, 1706, 1698, 1, 0, 0, 0, 1707, 1710, 1, 0, 0, 0, 1708, 1706, 1, 0, 0, 0, 1708, 1709, 1, 0, 0, 0, 1709, 1713, 1, 0, 0, 0, 1710, 1708, 1, 0, 0, 0, 1711, 1712, 5, 151, 0, 0, 1712, 1714, 3, 68, 34, 0, 1713, 1711, 1, 0, 0, 0, 1713, 1714, 1, 0, 0, 0, 1714, 1719, 1, 0, 0, 0, 1715, 1717, 3, 134, 67, 0, 1716, 1715, 1, 0, 0, 0, 1716, 1717, 1, 0, 0, 0, 1717, 1718, 1, 0, 0, 0, 1718, 1720, 3, 136, 68, 0, 1719, 1716, 1, 0, 0, 0, 1719, 1720, 1, 0, 0, 0, 1720, 111, 1, 0, 0, 0, 1721, 1722, 3, 182, 91, 0, 1722, 1723, 5, 2, 0, 0, 1723, 1725, 1, 0, 0, 0, 1724, 1721, 1, 0, 0, 0, 1724, 1725, 1, 0, 0, 0, 1725, 1726, 1, 0, 0, 0, 1726, 1729, 3, 184, 92, 0, 1727, 1728, 5, 35, 0, 0, 1728, 1730, 3, 216, 108, 0, 1729, 1727, 1, 0, 0, 0, 1729, 1730, 1, 0, 0, 0, 1730, 1736, 1, 0, 0, 0, 1731, 1732, 5, 87, 0, 0, 1732, 1733, 5, 42, 0, 0, 1733, 1737, 3, 196, 98, 0, 1734, 1735, 5, 104, 0, 0, 1735, 1737, 5, 87, 0, 0, 1736, 1731, 1, 0, 0, 0, 1736, 1734, 1, 0, 0, 0, 1736, 1737, 1, 0, 0, 0, 1737, 113, 1, 0, 0, 0, 1738, 1740, 5, 146, 0, 0, 1739, 1741, 3, 182, 91, 0, 1740, 1739, 1, 0, 0, 0, 1740, 1741, 1, 0, 0, 0, 1741, 1744, 1, 0, 0, 0, 1742, 1743, 5, 93, 0, 0, 1743, 1745, 3, 218, 109, 0, 1744, 1742, 1, 0, 0, 0, 1744, 1745, 1, 0, 0, 0, 1745, 115, 1, 0, 0, 0, 1746, 1747, 5, 181, 0, 0, 1747, 1748, 5, 3, 0, 0, 1748, 1749, 5, 151, 0, 0, 1749, 1750, 3, 68, 34, 0, 1750, 1751, 5, 4, 0, 0, 1751, 117, 1, 0, 0, 0, 1752, 1754, 5, 3, 0, 0, 1753, 1755, 3, 220, 110, 0, 1754, 1753, 1, 0, 0, 0, 1754, 1755, 1, 0, 0, 0, 1755, 1766, 1, 0, 0, 0, 1756, 1757, 5, 156, 0, 0, 1757, 1758, 5, 42, 0, 0, 1758, 1763, 3, 68, 34, 0, 1759, 1760, 5, 5, 0, 0, 1760, 1762, 3, 68, 34, 0, 1761, 1759, 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1763, 1764, 1, 0, 0, 0, 1764, 1767, 1, 0, 0, 0, 1765, 1763, 1, 0, 0, 0, 1766, 1756, 1, 0, 0, 0, 1766, 1767, 1, 0, 0, 0, 1767, 1768, 1, 0, 0, 0, 1768, 1769, 5, 111, 0, 0, 1769, 1770, 5, 42, 0, 0, 1770, 1775, 3, 138, 69, 0, 1771, 1772, 5, 5, 0, 0, 1772, 1774, 3, 138, 69, 0, 1773, 1771, 1, 0, 0, 0, 1774, 1777, 1, 0, 0, 0, 1775, 1773, 1, 0, 0, 0, 1775, 1776, 1, 0, 0, 0, 1776, 1779, 1, 0, 0, 0, 1777, 1775, 1, 0, 0, 0, 1778, 1780, 3, 122, 61, 0, 1779, 1778, 1, 0, 0, 0, 1779, 1780, 1, 0, 0, 0, 1780, 1781, 1, 0, 0, 0, 1781, 1782, 5, 4, 0, 0, 1782, 119, 1, 0, 0, 0, 1783, 1817, 5, 155, 0, 0, 1784, 1818, 3, 214, 107, 0, 1785, 1787, 5, 3, 0, 0, 1786, 1788, 3, 220, 110, 0, 1787, 1786, 1, 0, 0, 0, 1787, 1788, 1, 0, 0, 0, 1788, 1799, 1, 0, 0, 0, 1789, 1790, 5, 156, 0, 0, 1790, 1791, 5, 42, 0, 0, 1791, 1796, 3, 68, 34, 0, 1792, 1793, 5, 5, 0, 0, 1793, 1795, 3, 68, 34, 0, 1794, 1792, 1, 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1796, 1797, 1, 0, 0, 0, 1797, 1800, 1, 0, 0, 0, 1798, 1796, 1, 0, 0, 0, 1799, 1789, 1, 0, 0, 0, 1799, 1800, 1, 0, 0, 0, 1800, 1811, 1, 0, 0, 0, 1801, 1802, 5, 111, 0, 0, 1802, 1803, 5, 42, 0, 0, 1803, 1808, 3, 138, 69, 0, 1804, 1805, 5, 5, 0, 0, 1805, 1807, 3, 138, 69, 0, 1806, 1804, 1, 0, 0, 0, 1807, 1810, 1, 0, 0, 0, 1808, 1806, 1, 0, 0, 0, 1808, 1809, 1, 0, 0, 0, 1809, 1812, 1, 0, 0, 0, 1810, 1808, 1, 0, 0, 0, 1811, 1801, 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1814, 1, 0, 0, 0, 1813, 1815, 3, 122, 61, 0, 1814, 1813, 1, 0, 0, 0, 1814, 1815, 1, 0, 0, 0, 1815, 1816, 1, 0, 0, 0, 1816, 1818, 5, 4, 0, 0, 1817, 1784, 1, 0, 0, 0, 1817, 1785, 1, 0, 0, 0, 1818, 121, 1, 0, 0, 0, 1819, 1827, 3, 124, 62, 0, 1820, 1821, 5, 183, 0, 0, 1821, 1822, 5, 103, 0, 0, 1822, 1828, 5, 185, 0, 0, 1823, 1824, 5, 160, 0, 0, 1824, 1828, 5, 129, 0, 0, 1825, 1828, 5, 80, 0, 0, 1826, 1828, 5, 184, 0, 0, 1827, 1820, 1, 0, 0, 0, 1827, 1823, 1, 0, 0, 0, 1827, 1825, 1, 0, 0, 0, 1827, 1826, 1, 0, 0, 0, 1827, 1828, 1, 0, 0, 0, 1828, 123, 1, 0, 0, 0, 1829, 1836, 7, 19, 0, 0, 1830, 1837, 3, 146, 73, 0, 1831, 1832, 5, 41, 0, 0, 1832, 1833, 3, 142, 71, 0, 1833, 1834, 5, 34, 0, 0, 1834, 1835, 3, 144, 72, 0, 1835, 1837, 1, 0, 0, 0, 1836, 1830, 1, 0, 0, 0, 1836, 1831, 1, 0, 0, 0, 1837, 125, 1, 0, 0, 0, 1838, 1839, 3, 222, 111, 0, 1839, 1849, 5, 3, 0, 0, 1840, 1845, 3, 68, 34, 0, 1841, 1842, 5, 5, 0, 0, 1842, 1844, 3, 68, 34, 0, 1843, 1841, 1, 0, 0, 0, 1844, 1847, 1, 0, 0, 0, 1845, 1843, 1, 0, 0, 0, 1845, 1846, 1, 0, 0, 0, 1846, 1850, 1, 0, 0, 0, 1847, 1845, 1, 0, 0, 0, 1848, 1850, 5, 7, 0, 0, 1849, 1840, 1, 0, 0, 0, 1849, 1848, 1, 0, 0, 0, 1850, 1851, 1, 0, 0, 0, 1851, 1852, 5, 4, 0, 0, 1852, 127, 1, 0, 0, 0, 1853, 1854, 3, 224, 112, 0, 1854, 1867, 5, 3, 0, 0, 1855, 1857, 5, 64, 0, 0, 1856, 1855, 1, 0, 0, 0, 1856, 1857, 1, 0, 0, 0, 1857, 1858, 1, 0, 0, 0, 1858, 1863, 3, 68, 34, 0, 1859, 1860, 5, 5, 0, 0, 1860, 1862, 3, 68, 34, 0, 1861, 1859, 1, 0, 0, 0, 1862, 1865, 1, 0, 0, 0, 1863, 1861, 1, 0, 0, 0, 1863, 1864, 1, 0, 0, 0, 1864, 1868, 1, 0, 0, 0, 1865, 1863, 1, 0, 0, 0, 1866, 1868, 5, 7, 0, 0, 1867, 1856, 1, 0, 0, 0, 1867, 1866, 1, 0, 0, 0, 1867, 1868, 1, 0, 0, 0, 1868, 1869, 1, 0, 0, 0, 1869, 1871, 5, 4, 0, 0, 1870, 1872, 3, 116, 58, 0, 1871, 1870, 1, 0, 0, 0, 1871, 1872, 1, 0, 0, 0, 1872, 129, 1, 0, 0, 0, 1873, 1874, 3, 148, 74, 0, 1874, 1884, 5, 3, 0, 0, 1875, 1880, 3, 68, 34, 0, 1876, 1877, 5, 5, 0, 0, 1877, 1879, 3, 68, 34, 0, 1878, 1876, 1, 0, 0, 0, 1879, 1882, 1, 0, 0, 0, 1880, 1878, 1, 0, 0, 0, 1880, 1881, 1, 0, 0, 0, 1881, 1885, 1, 0, 0, 0, 1882, 1880, 1, 0, 0, 0, 1883, 1885, 5, 7, 0, 0, 1884, 1875, 1, 0, 0, 0, 1884, 1883, 1, 0, 0, 0, 1884, 1885, 1, 0, 0, 0, 1885, 1886, 1, 0, 0, 0, 1886, 1888, 5, 4, 0, 0, 1887, 1889, 3, 116, 58, 0, 1888, 1887, 1, 0, 0, 0, 1888, 1889, 1, 0, 0, 0, 1889, 1890, 1, 0, 0, 0, 1890, 1893, 5, 155, 0, 0, 1891, 1894, 3, 118, 59, 0, 1892, 1894, 3, 214, 107, 0, 1893, 1891, 1, 0, 0, 0, 1893, 1892, 1, 0, 0, 0, 1894, 131, 1, 0, 0, 0, 1895, 1897, 5, 152, 0, 0, 1896, 1898, 5, 118, 0, 0, 1897, 1896, 1, 0, 0, 0, 1897, 1898, 1, 0, 0, 0, 1898, 1899, 1, 0, 0, 0, 1899, 1904, 3, 56, 28, 0, 1900, 1901, 5, 5, 0, 0, 1901, 1903, 3, 56, 28, 0, 1902, 1900, 1, 0, 0, 0, 1903, 1906, 1, 0, 0, 0, 1904, 1902, 1, 0, 0, 0, 1904, 1905, 1, 0, 0, 0, 1905, 133, 1, 0, 0, 0, 1906, 1904, 1, 0, 0, 0, 1907, 1908, 5, 111, 0, 0, 1908, 1909, 5, 42, 0, 0, 1909, 1914, 3, 138, 69, 0, 1910, 1911, 5, 5, 0, 0, 1911, 1913, 3, 138, 69, 0, 1912, 1910, 1, 0, 0, 0, 1913, 1916, 1, 0, 0, 0, 1914, 1912, 1, 0, 0, 0, 1914, 1915, 1, 0, 0, 0, 1915, 135, 1, 0, 0, 0, 1916, 1914, 1, 0, 0, 0, 1917, 1918, 5, 100, 0, 0, 1918, 1921, 3, 68, 34, 0, 1919, 1920, 7, 20, 0, 0, 1920, 1922, 3, 68, 34, 0, 1921, 1919, 1, 0, 0, 0, 1921, 1922, 1, 0, 0, 0, 1922, 137, 1, 0, 0, 0, 1923, 1926, 3, 68, 34, 0, 1924, 1925, 5, 47, 0, 0, 1925, 1927, 3, 192, 96, 0, 1926, 1924, 1, 0, 0, 0, 1926, 1927, 1, 0, 0, 0, 1927, 1929, 1, 0, 0, 0, 1928, 1930, 3, 140, 70, 0, 1929, 1928, 1, 0, 0, 0, 1929, 1930, 1, 0, 0, 0, 1930, 1933, 1, 0, 0, 0, 1931, 1932, 5, 178, 0, 0, 1932, 1934, 7, 21, 0, 0, 1933, 1931, 1, 0, 0, 0, 1933, 1934, 1, 0, 0, 0, 1934, 139, 1, 0, 0, 0, 1935, 1936, 7, 22, 0, 0, 1936, 141, 1, 0, 0, 0, 1937, 1938, 3, 68, 34, 0, 1938, 1939, 5, 158, 0, 0, 1939, 1948, 1, 0, 0, 0, 1940, 1941, 3, 68, 34, 0, 1941, 1942, 5, 161, 0, 0, 1942, 1948, 1, 0, 0, 0, 1943, 1944, 5, 160, 0, 0, 1944, 1948, 5, 129, 0, 0, 1945, 1946, 5, 159, 0, 0, 1946, 1948, 5, 158, 0, 0, 1947, 1937, 1, 0, 0, 0, 1947, 1940, 1, 0, 0, 0, 1947, 1943, 1, 0, 0, 0, 1947, 1945, 1, 0, 0, 0, 1948, 143, 1, 0, 0, 0, 1949, 1950, 3, 68, 34, 0, 1950, 1951, 5, 158, 0, 0, 1951, 1960, 1, 0, 0, 0, 1952, 1953, 3, 68, 34, 0, 1953, 1954, 5, 161, 0, 0, 1954, 1960, 1, 0, 0, 0, 1955, 1956, 5, 160, 0, 0, 1956, 1960, 5, 129, 0, 0, 1957, 1958, 5, 159, 0, 0, 1958, 1960, 5, 161, 0, 0, 1959, 1949, 1, 0, 0, 0, 1959, 1952, 1, 0, 0, 0, 1959, 1955, 1, 0, 0, 0, 1959, 1957, 1, 0, 0, 0, 1960, 145, 1, 0, 0, 0, 1961, 1962, 3, 68, 34, 0, 1962, 1963, 5, 158, 0, 0, 1963, 1969, 1, 0, 0, 0, 1964, 1965, 5, 159, 0, 0, 1965, 1969, 5, 158, 0, 0, 1966, 1967, 5, 160, 0, 0, 1967, 1969, 5, 129, 0, 0, 1968, 1961, 1, 0, 0, 0, 1968, 1964, 1, 0, 0, 0, 1968, 1966, 1, 0, 0, 0, 1969, 147, 1, 0, 0, 0, 1970, 1971, 7, 23, 0, 0, 1971, 1972, 5, 3, 0, 0, 1972, 1973, 3, 68, 34, 0, 1973, 1974, 5, 4, 0, 0, 1974, 1975, 5, 155, 0, 0, 1975, 1977, 5, 3, 0, 0, 1976, 1978, 3, 154, 77, 0, 1977, 1976, 1, 0, 0, 0, 1977, 1978, 1, 0, 0, 0, 1978, 1979, 1, 0, 0, 0, 1979, 1981, 3, 158, 79, 0, 1980, 1982, 3, 124, 62, 0, 1981, 1980, 1, 0, 0, 0, 1981, 1982, 1, 0, 0, 0, 1982, 1983, 1, 0, 0, 0, 1983, 1984, 5, 4, 0, 0, 1984, 2056, 1, 0, 0, 0, 1985, 1986, 7, 24, 0, 0, 1986, 1987, 5, 3, 0, 0, 1987, 1988, 5, 4, 0, 0, 1988, 1989, 5, 155, 0, 0, 1989, 1991, 5, 3, 0, 0, 1990, 1992, 3, 154, 77, 0, 1991, 1990, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 1994, 1, 0, 0, 0, 1993, 1995, 3, 156, 78, 0, 1994, 1993, 1, 0, 0, 0, 1994, 1995, 1, 0, 0, 0, 1995, 1996, 1, 0, 0, 0, 1996, 2056, 5, 4, 0, 0, 1997, 1998, 7, 25, 0, 0, 1998, 1999, 5, 3, 0, 0, 1999, 2000, 5, 4, 0, 0, 2000, 2001, 5, 155, 0, 0, 2001, 2003, 5, 3, 0, 0, 2002, 2004, 3, 154, 77, 0, 2003, 2002, 1, 0, 0, 0, 2003, 2004, 1, 0, 0, 0, 2004, 2005, 1, 0, 0, 0, 2005, 2006, 3, 158, 79, 0, 2006, 2007, 5, 4, 0, 0, 2007, 2056, 1, 0, 0, 0, 2008, 2009, 7, 26, 0, 0, 2009, 2010, 5, 3, 0, 0, 2010, 2012, 3, 68, 34, 0, 2011, 2013, 3, 150, 75, 0, 2012, 2011, 1, 0, 0, 0, 2012, 2013, 1, 0, 0, 0, 2013, 2015, 1, 0, 0, 0, 2014, 2016, 3, 152, 76, 0, 2015, 2014, 1, 0, 0, 0, 2015, 2016, 1, 0, 0, 0, 2016, 2017, 1, 0, 0, 0, 2017, 2018, 5, 4, 0, 0, 2018, 2019, 5, 155, 0, 0, 2019, 2021, 5, 3, 0, 0, 2020, 2022, 3, 154, 77, 0, 2021, 2020, 1, 0, 0, 0, 2021, 2022, 1, 0, 0, 0, 2022, 2023, 1, 0, 0, 0, 2023, 2024, 3, 158, 79, 0, 2024, 2025, 5, 4, 0, 0, 2025, 2056, 1, 0, 0, 0, 2026, 2027, 5, 167, 0, 0, 2027, 2028, 5, 3, 0, 0, 2028, 2029, 3, 68, 34, 0, 2029, 2030, 5, 5, 0, 0, 2030, 2031, 3, 36, 18, 0, 2031, 2032, 5, 4, 0, 0, 2032, 2033, 5, 155, 0, 0, 2033, 2035, 5, 3, 0, 0, 2034, 2036, 3, 154, 77, 0, 2035, 2034, 1, 0, 0, 0, 2035, 2036, 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2039, 3, 158, 79, 0, 2038, 2040, 3, 124, 62, 0, 2039, 2038, 1, 0, 0, 0, 2039, 2040, 1, 0, 0, 0, 2040, 2041, 1, 0, 0, 0, 2041, 2042, 5, 4, 0, 0, 2042, 2056, 1, 0, 0, 0, 2043, 2044, 5, 168, 0, 0, 2044, 2045, 5, 3, 0, 0, 2045, 2046, 3, 68, 34, 0, 2046, 2047, 5, 4, 0, 0, 2047, 2048, 5, 155, 0, 0, 2048, 2050, 5, 3, 0, 0, 2049, 2051, 3, 154, 77, 0, 2050, 2049, 1, 0, 0, 0, 2050, 2051, 1, 0, 0, 0, 2051, 2052, 1, 0, 0, 0, 2052, 2053, 3, 158, 79, 0, 2053, 2054, 5, 4, 0, 0, 2054, 2056, 1, 0, 0, 0, 2055, 1970, 1, 0, 0, 0, 2055, 1985, 1, 0, 0, 0, 2055, 1997, 1, 0, 0, 0, 2055, 2008, 1, 0, 0, 0, 2055, 2026, 1, 0, 0, 0, 2055, 2043, 1, 0, 0, 0, 2056, 149, 1, 0, 0, 0, 2057, 2058, 5, 5, 0, 0, 2058, 2059, 3, 36, 18, 0, 2059, 151, 1, 0, 0, 0, 2060, 2061, 5, 5, 0, 0, 2061, 2062, 3, 36, 18, 0, 2062, 153, 1, 0, 0, 0, 2063, 2064, 5, 156, 0, 0, 2064, 2066, 5, 42, 0, 0, 2065, 2067, 3, 68, 34, 0, 2066, 2065, 1, 0, 0, 0, 2067, 2068, 1, 0, 0, 0, 2068, 2066, 1, 0, 0, 0, 2068, 2069, 1, 0, 0, 0, 2069, 155, 1, 0, 0, 0, 2070, 2071, 5, 111, 0, 0, 2071, 2073, 5, 42, 0, 0, 2072, 2074, 3, 68, 34, 0, 2073, 2072, 1, 0, 0, 0, 2074, 2075, 1, 0, 0, 0, 2075, 2073, 1, 0, 0, 0, 2075, 2076, 1, 0, 0, 0, 2076, 157, 1, 0, 0, 0, 2077, 2078, 5, 111, 0, 0, 2078, 2079, 5, 42, 0, 0, 2079, 2080, 3, 158, 79, 0, 2080, 159, 1, 0, 0, 0, 2081, 2083, 3, 68, 34, 0, 2082, 2084, 3, 140, 70, 0, 2083, 2082, 1, 0, 0, 0, 2083, 2084, 1, 0, 0, 0, 2084, 2092, 1, 0, 0, 0, 2085, 2086, 5, 5, 0, 0, 2086, 2088, 3, 68, 34, 0, 2087, 2089, 3, 140, 70, 0, 2088, 2087, 1, 0, 0, 0, 2088, 2089, 1, 0, 0, 0, 2089, 2091, 1, 0, 0, 0, 2090, 2085, 1, 0, 0, 0, 2091, 2094, 1, 0, 0, 0, 2092, 2090, 1, 0, 0, 0, 2092, 2093, 1, 0, 0, 0, 2093, 161, 1, 0, 0, 0, 2094, 2092, 1, 0, 0, 0, 2095, 2096, 3, 84, 42, 0, 2096, 163, 1, 0, 0, 0, 2097, 2098, 3, 84, 42, 0, 2098, 165, 1, 0, 0, 0, 2099, 2100, 7, 27, 0, 0, 2100, 167, 1, 0, 0, 0, 2101, 2102, 5, 192, 0, 0, 2102, 169, 1, 0, 0, 0, 2103, 2106, 3, 68, 34, 0, 2104, 2106, 3, 30, 15, 0, 2105, 2103, 1, 0, 0, 0, 2105, 2104, 1, 0, 0, 0, 2106, 171, 1, 0, 0, 0, 2107, 2108, 7, 28, 0, 0, 2108, 173, 1, 0, 0, 0, 2109, 2110, 7, 29, 0, 0, 2110, 175, 1, 0, 0, 0, 2111, 2112, 3, 228, 114, 0, 2112, 177, 1, 0, 0, 0, 2113, 2114, 3, 228, 114, 0, 2114, 179, 1, 0, 0, 0, 2115, 2116, 3, 182, 91, 0, 2116, 2117, 5, 2, 0, 0, 2117, 2119, 1, 0, 0, 0, 2118, 2115, 1, 0, 0, 0, 2118, 2119, 1, 0, 0, 0, 2119, 2120, 1, 0, 0, 0, 2120, 2121, 3, 178, 89, 0, 2121, 181, 1, 0, 0, 0, 2122, 2123, 3, 228, 114, 0, 2123, 183, 1, 0, 0, 0, 2124, 2125, 3, 228, 114, 0, 2125, 185, 1, 0, 0, 0, 2126, 2127, 3, 228, 114, 0, 2127, 187, 1, 0, 0, 0, 2128, 2129, 3, 228, 114, 0, 2129, 189, 1, 0, 0, 0, 2130, 2131, 3, 228, 114, 0, 2131, 191, 1, 0, 0, 0, 2132, 2133, 3, 228, 114, 0, 2133, 193, 1, 0, 0, 0, 2134, 2135, 3, 228, 114, 0, 2135, 195, 1, 0, 0, 0, 2136, 2137, 3, 228, 114, 0, 2137, 197, 1, 0, 0, 0, 2138, 2139, 3, 228, 114, 0, 2139, 199, 1, 0, 0, 0, 2140, 2141, 3, 228, 114, 0, 2141, 201, 1, 0, 0, 0, 2142, 2143, 3, 228, 114, 0, 2143, 203, 1, 0, 0, 0, 2144, 2145, 3, 228, 114, 0, 2145, 205, 1, 0, 0, 0, 2146, 2147, 3, 228, 114, 0, 2147, 207, 1, 0, 0, 0, 2148, 2149, 7, 28, 0, 0, 2149, 209, 1, 0, 0, 0, 2150, 2151, 3, 228, 114, 0, 2151, 211, 1, 0, 0, 0, 2152, 2153, 3, 228, 114, 0, 2153, 213, 1, 0, 0, 0, 2154, 2155, 3, 228, 114, 0, 2155, 215, 1, 0, 0, 0, 2156, 2157, 3, 228, 114, 0, 2157, 217, 1, 0, 0, 0, 2158, 2159, 3, 228, 114, 0, 2159, 219, 1, 0, 0, 0, 2160, 2161, 3, 228, 114, 0, 2161, 221, 1, 0, 0, 0, 2162, 2163, 3, 228, 114, 0, 2163, 223, 1, 0, 0, 0, 2164, 2165, 3, 228, 114, 0, 2165, 225, 1, 0, 0, 0, 2166, 2167, 3, 228, 114, 0, 2167, 227, 1, 0, 0, 0, 2168, 2176, 5, 188, 0, 0, 2169, 2176, 3, 174, 87, 0, 2170, 2176, 5, 192, 0, 0, 2171, 2172, 5, 3, 0, 0, 2172, 2173, 3, 228, 114, 0, 2173, 2174, 5, 4, 0, 0, 2174, 2176, 1, 0, 0, 0, 2175, 2168, 1, 0, 0, 0, 2175, 2169, 1, 0, 0, 0, 2175, 2170, 1, 0, 0, 0, 2175, 2171, 1, 0, 0, 0, 2176, 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, 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, 1204, 1207, 1210, 1214, 1224, 1230, 1232, 1240, 1247, 1254, 1259, 1261, 1267, 1276, 1281, 1288, 1292, 1294, 1297, 1305, 1309, 1312, 1321, 1326, 1333, 1342, 1346, 1348, 1352, 1361, 1366, 1368, 1381, 1384, 1393, 1404, 1411, 1414, 1419, 1423, 1426, 1429, 1434, 1438, 1443, 1446, 1449, 1454, 1458, 1461, 1468, 1473, 1482, 1487, 1490, 1498, 1502, 1510, 1513, 1518, 1522, 1525, 1532, 1537, 1546, 1551, 1554, 1562, 1566, 1574, 1577, 1579, 1588, 1591, 1593, 1597, 1601, 1604, 1609, 1620, 1625, 1629, 1633, 1636, 1641, 1647, 1654, 1661, 1666, 1669, 1677, 1683, 1688, 1694, 1701, 1708, 1713, 1716, 1719, 1724, 1729, 1736, 1740, 1744, 1754, 1763, 1766, 1775, 1779, 1787, 1796, 1799, 1808, 1811, 1814, 1817, 1827, 1836, 1845, 1849, 1856, 1863, 1867, 1871, 1880, 1884, 1888, 1893, 1897, 1904, 1914, 1921, 1926, 1929, 1933, 1947, 1959, 1968, 1977, 1981, 1991, 1994, 2003, 2012, 2015, 2021, 2035, 2039, 2050, 2055, 2068, 2075, 2083, 2088, 2092, 2105, 2118, 2175] \ 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 cd85d7fa69..424c92ad2a 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, 2173, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, + 4, 1, 197, 2178, 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,138 @@ 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, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, - 1036, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, - 34, 3, 34, 1047, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, - 3, 34, 1056, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 1064, - 8, 34, 10, 34, 12, 34, 1067, 9, 34, 3, 34, 1069, 8, 34, 1, 34, 1, 34, 1, - 34, 1, 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, 1, 34, 5, 34, 1088, 8, 34, 10, 34, 12, - 34, 1091, 9, 34, 3, 34, 1093, 8, 34, 1, 34, 1, 34, 3, 34, 1097, 8, 34, - 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 1104, 8, 34, 1, 34, 1, 34, 1, - 34, 1, 34, 3, 34, 1110, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, - 1117, 8, 34, 5, 34, 1119, 8, 34, 10, 34, 12, 34, 1122, 9, 34, 1, 35, 1, - 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 1130, 8, 35, 1, 35, 1, 35, 1, 36, - 1, 36, 1, 37, 3, 37, 1137, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, - 37, 1144, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 1150, 8, 37, 1, 37, - 1, 37, 1, 37, 3, 37, 1155, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1161, - 8, 37, 10, 37, 12, 37, 1164, 9, 37, 1, 37, 1, 37, 3, 37, 1168, 8, 37, 1, - 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1175, 8, 37, 10, 37, 12, 37, 1178, - 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 1186, 8, 37, 10, - 37, 12, 37, 1189, 9, 37, 1, 37, 1, 37, 5, 37, 1193, 8, 37, 10, 37, 12, - 37, 1196, 9, 37, 1, 37, 3, 37, 1199, 8, 37, 1, 37, 3, 37, 1202, 8, 37, - 1, 37, 3, 37, 1205, 8, 37, 1, 37, 1, 37, 3, 37, 1209, 8, 37, 1, 38, 1, - 38, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1217, 8, 38, 10, 38, 12, 38, 1220, - 9, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1225, 8, 38, 3, 38, 1227, 8, 38, 1, - 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 1235, 8, 38, 1, 38, 1, 38, - 1, 38, 1, 38, 1, 38, 3, 38, 1242, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1247, - 8, 38, 10, 38, 12, 38, 1250, 9, 38, 1, 38, 1, 38, 3, 38, 1254, 8, 38, 3, - 38, 1256, 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1262, 8, 39, 1, 39, - 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1271, 8, 39, 1, 40, 1, - 40, 1, 40, 3, 40, 1276, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, - 1283, 8, 41, 1, 41, 1, 41, 3, 41, 1287, 8, 41, 3, 41, 1289, 8, 41, 1, 42, - 3, 42, 1292, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1298, 8, 42, 10, - 42, 12, 42, 1301, 9, 42, 1, 42, 3, 42, 1304, 8, 42, 1, 42, 3, 42, 1307, - 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 3, 43, 1313, 8, 43, 5, 43, 1315, 8, - 43, 10, 43, 12, 43, 1318, 9, 43, 1, 44, 1, 44, 3, 44, 1322, 8, 44, 1, 44, - 1, 44, 1, 44, 5, 44, 1327, 8, 44, 10, 44, 12, 44, 1330, 9, 44, 1, 44, 1, - 44, 1, 44, 1, 44, 5, 44, 1336, 8, 44, 10, 44, 12, 44, 1339, 9, 44, 1, 44, - 3, 44, 1342, 8, 44, 3, 44, 1344, 8, 44, 1, 44, 1, 44, 3, 44, 1348, 8, 44, - 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1355, 8, 44, 10, 44, 12, 44, - 1358, 9, 44, 1, 44, 1, 44, 3, 44, 1362, 8, 44, 3, 44, 1364, 8, 44, 1, 44, - 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1375, 8, - 44, 10, 44, 12, 44, 1378, 9, 44, 3, 44, 1380, 8, 44, 1, 44, 1, 44, 1, 44, - 1, 44, 1, 44, 5, 44, 1387, 8, 44, 10, 44, 12, 44, 1390, 9, 44, 1, 44, 1, - 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1398, 8, 44, 10, 44, 12, 44, 1401, - 9, 44, 1, 44, 1, 44, 5, 44, 1405, 8, 44, 10, 44, 12, 44, 1408, 9, 44, 3, - 44, 1410, 8, 44, 1, 45, 1, 45, 1, 46, 3, 46, 1415, 8, 46, 1, 46, 1, 46, - 3, 46, 1419, 8, 46, 1, 46, 3, 46, 1422, 8, 46, 1, 47, 3, 47, 1425, 8, 47, - 1, 47, 1, 47, 1, 47, 3, 47, 1430, 8, 47, 1, 47, 1, 47, 3, 47, 1434, 8, - 47, 1, 47, 4, 47, 1437, 8, 47, 11, 47, 12, 47, 1438, 1, 47, 3, 47, 1442, - 8, 47, 1, 47, 3, 47, 1445, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1450, 8, - 48, 1, 48, 1, 48, 3, 48, 1454, 8, 48, 1, 48, 3, 48, 1457, 8, 48, 1, 48, - 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1464, 8, 48, 1, 48, 1, 48, 1, 48, 3, - 48, 1469, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1476, 8, 48, - 10, 48, 12, 48, 1479, 9, 48, 1, 48, 1, 48, 3, 48, 1483, 8, 48, 1, 48, 3, - 48, 1486, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1492, 8, 48, 10, 48, - 12, 48, 1495, 9, 48, 1, 48, 3, 48, 1498, 8, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 1, 48, 1, 48, 3, 48, 1506, 8, 48, 1, 48, 3, 48, 1509, 8, 48, 1, 48, - 1, 48, 1, 48, 3, 48, 1514, 8, 48, 1, 48, 1, 48, 3, 48, 1518, 8, 48, 1, - 48, 3, 48, 1521, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1528, - 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1533, 8, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 1, 48, 5, 48, 1540, 8, 48, 10, 48, 12, 48, 1543, 9, 48, 1, 48, 1, 48, - 3, 48, 1547, 8, 48, 1, 48, 3, 48, 1550, 8, 48, 1, 48, 1, 48, 1, 48, 1, - 48, 5, 48, 1556, 8, 48, 10, 48, 12, 48, 1559, 9, 48, 1, 48, 3, 48, 1562, - 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1570, 8, 48, 1, - 48, 3, 48, 1573, 8, 48, 3, 48, 1575, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, - 1, 49, 1, 49, 1, 49, 3, 49, 1584, 8, 49, 1, 49, 3, 49, 1587, 8, 49, 3, - 49, 1589, 8, 49, 1, 50, 1, 50, 3, 50, 1593, 8, 50, 1, 50, 1, 50, 3, 50, - 1597, 8, 50, 1, 50, 3, 50, 1600, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1605, - 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1614, 8, - 51, 10, 51, 12, 51, 1617, 9, 51, 1, 51, 1, 51, 3, 51, 1621, 8, 51, 1, 52, - 1, 52, 3, 52, 1625, 8, 52, 1, 52, 1, 52, 3, 52, 1629, 8, 52, 1, 53, 3, - 53, 1632, 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1637, 8, 53, 1, 53, 1, 53, - 1, 53, 1, 53, 3, 53, 1643, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, - 53, 1650, 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1655, 8, 53, 10, 53, 12, 53, - 1658, 9, 53, 1, 53, 1, 53, 3, 53, 1662, 8, 53, 1, 53, 3, 53, 1665, 8, 53, - 1, 54, 1, 54, 1, 54, 1, 54, 5, 54, 1671, 8, 54, 10, 54, 12, 54, 1674, 9, - 54, 1, 54, 1, 54, 1, 55, 3, 55, 1679, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, - 1684, 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1690, 8, 55, 1, 55, 1, - 55, 1, 55, 1, 55, 1, 55, 3, 55, 1697, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, - 1702, 8, 55, 10, 55, 12, 55, 1705, 9, 55, 1, 55, 1, 55, 3, 55, 1709, 8, - 55, 1, 55, 3, 55, 1712, 8, 55, 1, 55, 3, 55, 1715, 8, 55, 1, 56, 1, 56, - 1, 56, 3, 56, 1720, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1725, 8, 56, 1, - 56, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1732, 8, 56, 1, 57, 1, 57, 3, 57, - 1736, 8, 57, 1, 57, 1, 57, 3, 57, 1740, 8, 57, 1, 58, 1, 58, 1, 58, 1, - 58, 1, 58, 1, 58, 1, 59, 1, 59, 3, 59, 1750, 8, 59, 1, 59, 1, 59, 1, 59, - 1, 59, 1, 59, 5, 59, 1757, 8, 59, 10, 59, 12, 59, 1760, 9, 59, 3, 59, 1762, - 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1769, 8, 59, 10, 59, 12, - 59, 1772, 9, 59, 1, 59, 3, 59, 1775, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, - 1, 60, 1, 60, 3, 60, 1783, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, - 60, 1790, 8, 60, 10, 60, 12, 60, 1793, 9, 60, 3, 60, 1795, 8, 60, 1, 60, - 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1802, 8, 60, 10, 60, 12, 60, 1805, 9, - 60, 3, 60, 1807, 8, 60, 1, 60, 3, 60, 1810, 8, 60, 1, 60, 3, 60, 1813, - 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1823, - 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1832, 8, - 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1839, 8, 63, 10, 63, 12, - 63, 1842, 9, 63, 1, 63, 3, 63, 1845, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, - 1, 64, 3, 64, 1852, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1857, 8, 64, 10, - 64, 12, 64, 1860, 9, 64, 1, 64, 3, 64, 1863, 8, 64, 1, 64, 1, 64, 3, 64, - 1867, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1874, 8, 65, 10, - 65, 12, 65, 1877, 9, 65, 1, 65, 3, 65, 1880, 8, 65, 1, 65, 1, 65, 3, 65, - 1884, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1889, 8, 65, 1, 66, 1, 66, 3, - 66, 1893, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1898, 8, 66, 10, 66, 12, 66, - 1901, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1908, 8, 67, 10, - 67, 12, 67, 1911, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1917, 8, 68, - 1, 69, 1, 69, 1, 69, 3, 69, 1922, 8, 69, 1, 69, 3, 69, 1925, 8, 69, 1, - 69, 1, 69, 3, 69, 1929, 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, 1943, 8, 71, 1, 72, 1, - 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1955, - 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1964, 8, - 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1973, 8, 74, - 1, 74, 1, 74, 3, 74, 1977, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, - 74, 1, 74, 1, 74, 3, 74, 1987, 8, 74, 1, 74, 3, 74, 1990, 8, 74, 1, 74, - 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1999, 8, 74, 1, 74, 1, - 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2008, 8, 74, 1, 74, 3, 74, - 2011, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2017, 8, 74, 1, 74, 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, 3, 37, 1205, 8, 37, 1, 37, 3, 37, 1208, 8, 37, 1, 37, 3, 37, + 1211, 8, 37, 1, 37, 1, 37, 3, 37, 1215, 8, 37, 1, 38, 1, 38, 1, 38, 1, + 38, 1, 38, 1, 38, 5, 38, 1223, 8, 38, 10, 38, 12, 38, 1226, 9, 38, 1, 38, + 1, 38, 1, 38, 3, 38, 1231, 8, 38, 3, 38, 1233, 8, 38, 1, 38, 1, 38, 1, + 38, 1, 38, 1, 38, 1, 38, 3, 38, 1241, 8, 38, 1, 38, 1, 38, 1, 38, 1, 38, + 1, 38, 3, 38, 1248, 8, 38, 1, 38, 1, 38, 1, 38, 5, 38, 1253, 8, 38, 10, + 38, 12, 38, 1256, 9, 38, 1, 38, 1, 38, 3, 38, 1260, 8, 38, 3, 38, 1262, + 8, 38, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1268, 8, 39, 1, 39, 1, 39, 1, + 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 1277, 8, 39, 1, 40, 1, 40, 1, 40, + 3, 40, 1282, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 1289, 8, + 41, 1, 41, 1, 41, 3, 41, 1293, 8, 41, 3, 41, 1295, 8, 41, 1, 42, 3, 42, + 1298, 8, 42, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 1304, 8, 42, 10, 42, 12, + 42, 1307, 9, 42, 1, 42, 3, 42, 1310, 8, 42, 1, 42, 3, 42, 1313, 8, 42, + 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 1320, 8, 43, 10, 43, 12, 43, + 1323, 9, 43, 1, 44, 1, 44, 3, 44, 1327, 8, 44, 1, 44, 1, 44, 1, 44, 5, + 44, 1332, 8, 44, 10, 44, 12, 44, 1335, 9, 44, 1, 44, 1, 44, 1, 44, 1, 44, + 5, 44, 1341, 8, 44, 10, 44, 12, 44, 1344, 9, 44, 1, 44, 3, 44, 1347, 8, + 44, 3, 44, 1349, 8, 44, 1, 44, 1, 44, 3, 44, 1353, 8, 44, 1, 44, 1, 44, + 1, 44, 1, 44, 1, 44, 5, 44, 1360, 8, 44, 10, 44, 12, 44, 1363, 9, 44, 1, + 44, 1, 44, 3, 44, 1367, 8, 44, 3, 44, 1369, 8, 44, 1, 44, 1, 44, 1, 44, + 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 1380, 8, 44, 10, 44, 12, + 44, 1383, 9, 44, 3, 44, 1385, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, + 5, 44, 1392, 8, 44, 10, 44, 12, 44, 1395, 9, 44, 1, 44, 1, 44, 1, 44, 1, + 44, 1, 44, 1, 44, 5, 44, 1403, 8, 44, 10, 44, 12, 44, 1406, 9, 44, 1, 44, + 1, 44, 5, 44, 1410, 8, 44, 10, 44, 12, 44, 1413, 9, 44, 3, 44, 1415, 8, + 44, 1, 45, 1, 45, 1, 46, 3, 46, 1420, 8, 46, 1, 46, 1, 46, 3, 46, 1424, + 8, 46, 1, 46, 3, 46, 1427, 8, 46, 1, 47, 3, 47, 1430, 8, 47, 1, 47, 1, + 47, 1, 47, 3, 47, 1435, 8, 47, 1, 47, 1, 47, 3, 47, 1439, 8, 47, 1, 47, + 4, 47, 1442, 8, 47, 11, 47, 12, 47, 1443, 1, 47, 3, 47, 1447, 8, 47, 1, + 47, 3, 47, 1450, 8, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1455, 8, 48, 1, 48, + 1, 48, 3, 48, 1459, 8, 48, 1, 48, 3, 48, 1462, 8, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 3, 48, 1469, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1474, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1481, 8, 48, 10, 48, 12, + 48, 1484, 9, 48, 1, 48, 1, 48, 3, 48, 1488, 8, 48, 1, 48, 3, 48, 1491, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, 48, 1497, 8, 48, 10, 48, 12, 48, + 1500, 9, 48, 1, 48, 3, 48, 1503, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 3, 48, 1511, 8, 48, 1, 48, 3, 48, 1514, 8, 48, 1, 48, 1, 48, + 1, 48, 3, 48, 1519, 8, 48, 1, 48, 1, 48, 3, 48, 1523, 8, 48, 1, 48, 3, + 48, 1526, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1533, 8, 48, + 1, 48, 1, 48, 1, 48, 3, 48, 1538, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 5, 48, 1545, 8, 48, 10, 48, 12, 48, 1548, 9, 48, 1, 48, 1, 48, 3, 48, + 1552, 8, 48, 1, 48, 3, 48, 1555, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 5, + 48, 1561, 8, 48, 10, 48, 12, 48, 1564, 9, 48, 1, 48, 3, 48, 1567, 8, 48, + 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 1575, 8, 48, 1, 48, 3, + 48, 1578, 8, 48, 3, 48, 1580, 8, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, + 1, 49, 1, 49, 3, 49, 1589, 8, 49, 1, 49, 3, 49, 1592, 8, 49, 3, 49, 1594, + 8, 49, 1, 50, 1, 50, 3, 50, 1598, 8, 50, 1, 50, 1, 50, 3, 50, 1602, 8, + 50, 1, 50, 3, 50, 1605, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 1610, 8, 50, + 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 1619, 8, 51, 10, + 51, 12, 51, 1622, 9, 51, 1, 51, 1, 51, 3, 51, 1626, 8, 51, 1, 52, 1, 52, + 3, 52, 1630, 8, 52, 1, 52, 1, 52, 3, 52, 1634, 8, 52, 1, 53, 3, 53, 1637, + 8, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1642, 8, 53, 1, 53, 1, 53, 1, 53, 1, + 53, 3, 53, 1648, 8, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 1655, + 8, 53, 1, 53, 1, 53, 1, 53, 5, 53, 1660, 8, 53, 10, 53, 12, 53, 1663, 9, + 53, 1, 53, 1, 53, 3, 53, 1667, 8, 53, 1, 53, 3, 53, 1670, 8, 53, 1, 54, + 1, 54, 1, 54, 1, 54, 5, 54, 1676, 8, 54, 10, 54, 12, 54, 1679, 9, 54, 1, + 54, 1, 54, 1, 55, 3, 55, 1684, 8, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1689, + 8, 55, 1, 55, 1, 55, 1, 55, 1, 55, 3, 55, 1695, 8, 55, 1, 55, 1, 55, 1, + 55, 1, 55, 1, 55, 3, 55, 1702, 8, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1707, + 8, 55, 10, 55, 12, 55, 1710, 9, 55, 1, 55, 1, 55, 3, 55, 1714, 8, 55, 1, + 55, 3, 55, 1717, 8, 55, 1, 55, 3, 55, 1720, 8, 55, 1, 56, 1, 56, 1, 56, + 3, 56, 1725, 8, 56, 1, 56, 1, 56, 1, 56, 3, 56, 1730, 8, 56, 1, 56, 1, + 56, 1, 56, 1, 56, 1, 56, 3, 56, 1737, 8, 56, 1, 57, 1, 57, 3, 57, 1741, + 8, 57, 1, 57, 1, 57, 3, 57, 1745, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, + 58, 1, 58, 1, 59, 1, 59, 3, 59, 1755, 8, 59, 1, 59, 1, 59, 1, 59, 1, 59, + 1, 59, 5, 59, 1762, 8, 59, 10, 59, 12, 59, 1765, 9, 59, 3, 59, 1767, 8, + 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 5, 59, 1774, 8, 59, 10, 59, 12, + 59, 1777, 9, 59, 1, 59, 3, 59, 1780, 8, 59, 1, 59, 1, 59, 1, 60, 1, 60, + 1, 60, 1, 60, 3, 60, 1788, 8, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 5, + 60, 1795, 8, 60, 10, 60, 12, 60, 1798, 9, 60, 3, 60, 1800, 8, 60, 1, 60, + 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1807, 8, 60, 10, 60, 12, 60, 1810, 9, + 60, 3, 60, 1812, 8, 60, 1, 60, 3, 60, 1815, 8, 60, 1, 60, 3, 60, 1818, + 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 1828, + 8, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1837, 8, + 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 1844, 8, 63, 10, 63, 12, + 63, 1847, 9, 63, 1, 63, 3, 63, 1850, 8, 63, 1, 63, 1, 63, 1, 64, 1, 64, + 1, 64, 3, 64, 1857, 8, 64, 1, 64, 1, 64, 1, 64, 5, 64, 1862, 8, 64, 10, + 64, 12, 64, 1865, 9, 64, 1, 64, 3, 64, 1868, 8, 64, 1, 64, 1, 64, 3, 64, + 1872, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1879, 8, 65, 10, + 65, 12, 65, 1882, 9, 65, 1, 65, 3, 65, 1885, 8, 65, 1, 65, 1, 65, 3, 65, + 1889, 8, 65, 1, 65, 1, 65, 1, 65, 3, 65, 1894, 8, 65, 1, 66, 1, 66, 3, + 66, 1898, 8, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1903, 8, 66, 10, 66, 12, 66, + 1906, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1913, 8, 67, 10, + 67, 12, 67, 1916, 9, 67, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1922, 8, 68, + 1, 69, 1, 69, 1, 69, 3, 69, 1927, 8, 69, 1, 69, 3, 69, 1930, 8, 69, 1, + 69, 1, 69, 3, 69, 1934, 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, 1948, 8, 71, 1, 72, 1, + 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1960, + 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1969, 8, + 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1978, 8, 74, + 1, 74, 1, 74, 3, 74, 1982, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, + 74, 1, 74, 1, 74, 3, 74, 1992, 8, 74, 1, 74, 3, 74, 1995, 8, 74, 1, 74, + 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2004, 8, 74, 1, 74, 1, + 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2013, 8, 74, 1, 74, 3, 74, + 2016, 8, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2022, 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, 2031, 8, 74, 1, 74, 1, 74, 3, 74, 2035, 8, 74, 1, 74, 1, 74, 1, - 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2046, 8, 74, 1, 74, - 1, 74, 1, 74, 3, 74, 2051, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, - 76, 1, 77, 1, 77, 1, 77, 4, 77, 2062, 8, 77, 11, 77, 12, 77, 2063, 1, 78, - 1, 78, 1, 78, 4, 78, 2069, 8, 78, 11, 78, 12, 78, 2070, 1, 79, 1, 79, 1, - 79, 1, 79, 1, 80, 1, 80, 3, 80, 2079, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, - 2084, 8, 80, 5, 80, 2086, 8, 80, 10, 80, 12, 80, 2089, 9, 80, 1, 81, 1, - 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2101, + 3, 74, 2036, 8, 74, 1, 74, 1, 74, 3, 74, 2040, 8, 74, 1, 74, 1, 74, 1, + 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 2051, 8, 74, 1, 74, + 1, 74, 1, 74, 3, 74, 2056, 8, 74, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, + 76, 1, 77, 1, 77, 1, 77, 4, 77, 2067, 8, 77, 11, 77, 12, 77, 2068, 1, 78, + 1, 78, 1, 78, 4, 78, 2074, 8, 78, 11, 78, 12, 78, 2075, 1, 79, 1, 79, 1, + 79, 1, 79, 1, 80, 1, 80, 3, 80, 2084, 8, 80, 1, 80, 1, 80, 1, 80, 3, 80, + 2089, 8, 80, 5, 80, 2091, 8, 80, 10, 80, 12, 80, 2094, 9, 80, 1, 81, 1, + 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 3, 85, 2106, 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, 2114, 8, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, + 90, 1, 90, 3, 90, 2119, 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, 2171, 8, 114, 1, 114, 2, 449, 487, 1, 68, 115, + 1, 114, 1, 114, 3, 114, 2176, 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, @@ -347,826 +348,828 @@ func sqliteparserParserInit() { 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, 2477, 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, 1123, 1, 0, 0, 0, 72, - 1133, 1, 0, 0, 0, 74, 1208, 1, 0, 0, 0, 76, 1210, 1, 0, 0, 0, 78, 1257, - 1, 0, 0, 0, 80, 1275, 1, 0, 0, 0, 82, 1277, 1, 0, 0, 0, 84, 1291, 1, 0, - 0, 0, 86, 1308, 1, 0, 0, 0, 88, 1409, 1, 0, 0, 0, 90, 1411, 1, 0, 0, 0, - 92, 1414, 1, 0, 0, 0, 94, 1424, 1, 0, 0, 0, 96, 1574, 1, 0, 0, 0, 98, 1588, - 1, 0, 0, 0, 100, 1604, 1, 0, 0, 0, 102, 1620, 1, 0, 0, 0, 104, 1628, 1, - 0, 0, 0, 106, 1631, 1, 0, 0, 0, 108, 1666, 1, 0, 0, 0, 110, 1678, 1, 0, - 0, 0, 112, 1719, 1, 0, 0, 0, 114, 1733, 1, 0, 0, 0, 116, 1741, 1, 0, 0, - 0, 118, 1747, 1, 0, 0, 0, 120, 1778, 1, 0, 0, 0, 122, 1814, 1, 0, 0, 0, - 124, 1824, 1, 0, 0, 0, 126, 1833, 1, 0, 0, 0, 128, 1848, 1, 0, 0, 0, 130, - 1868, 1, 0, 0, 0, 132, 1890, 1, 0, 0, 0, 134, 1902, 1, 0, 0, 0, 136, 1912, - 1, 0, 0, 0, 138, 1918, 1, 0, 0, 0, 140, 1930, 1, 0, 0, 0, 142, 1942, 1, - 0, 0, 0, 144, 1954, 1, 0, 0, 0, 146, 1963, 1, 0, 0, 0, 148, 2050, 1, 0, - 0, 0, 150, 2052, 1, 0, 0, 0, 152, 2055, 1, 0, 0, 0, 154, 2058, 1, 0, 0, - 0, 156, 2065, 1, 0, 0, 0, 158, 2072, 1, 0, 0, 0, 160, 2076, 1, 0, 0, 0, - 162, 2090, 1, 0, 0, 0, 164, 2092, 1, 0, 0, 0, 166, 2094, 1, 0, 0, 0, 168, - 2096, 1, 0, 0, 0, 170, 2100, 1, 0, 0, 0, 172, 2102, 1, 0, 0, 0, 174, 2104, - 1, 0, 0, 0, 176, 2106, 1, 0, 0, 0, 178, 2108, 1, 0, 0, 0, 180, 2113, 1, - 0, 0, 0, 182, 2117, 1, 0, 0, 0, 184, 2119, 1, 0, 0, 0, 186, 2121, 1, 0, - 0, 0, 188, 2123, 1, 0, 0, 0, 190, 2125, 1, 0, 0, 0, 192, 2127, 1, 0, 0, - 0, 194, 2129, 1, 0, 0, 0, 196, 2131, 1, 0, 0, 0, 198, 2133, 1, 0, 0, 0, - 200, 2135, 1, 0, 0, 0, 202, 2137, 1, 0, 0, 0, 204, 2139, 1, 0, 0, 0, 206, - 2141, 1, 0, 0, 0, 208, 2143, 1, 0, 0, 0, 210, 2145, 1, 0, 0, 0, 212, 2147, - 1, 0, 0, 0, 214, 2149, 1, 0, 0, 0, 216, 2151, 1, 0, 0, 0, 218, 2153, 1, - 0, 0, 0, 220, 2155, 1, 0, 0, 0, 222, 2157, 1, 0, 0, 0, 224, 2159, 1, 0, - 0, 0, 226, 2161, 1, 0, 0, 0, 228, 2170, 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, + 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, + 2484, 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, 1214, 1, 0, 0, 0, 76, + 1216, 1, 0, 0, 0, 78, 1263, 1, 0, 0, 0, 80, 1281, 1, 0, 0, 0, 82, 1283, + 1, 0, 0, 0, 84, 1297, 1, 0, 0, 0, 86, 1314, 1, 0, 0, 0, 88, 1414, 1, 0, + 0, 0, 90, 1416, 1, 0, 0, 0, 92, 1419, 1, 0, 0, 0, 94, 1429, 1, 0, 0, 0, + 96, 1579, 1, 0, 0, 0, 98, 1593, 1, 0, 0, 0, 100, 1609, 1, 0, 0, 0, 102, + 1625, 1, 0, 0, 0, 104, 1633, 1, 0, 0, 0, 106, 1636, 1, 0, 0, 0, 108, 1671, + 1, 0, 0, 0, 110, 1683, 1, 0, 0, 0, 112, 1724, 1, 0, 0, 0, 114, 1738, 1, + 0, 0, 0, 116, 1746, 1, 0, 0, 0, 118, 1752, 1, 0, 0, 0, 120, 1783, 1, 0, + 0, 0, 122, 1819, 1, 0, 0, 0, 124, 1829, 1, 0, 0, 0, 126, 1838, 1, 0, 0, + 0, 128, 1853, 1, 0, 0, 0, 130, 1873, 1, 0, 0, 0, 132, 1895, 1, 0, 0, 0, + 134, 1907, 1, 0, 0, 0, 136, 1917, 1, 0, 0, 0, 138, 1923, 1, 0, 0, 0, 140, + 1935, 1, 0, 0, 0, 142, 1947, 1, 0, 0, 0, 144, 1959, 1, 0, 0, 0, 146, 1968, + 1, 0, 0, 0, 148, 2055, 1, 0, 0, 0, 150, 2057, 1, 0, 0, 0, 152, 2060, 1, + 0, 0, 0, 154, 2063, 1, 0, 0, 0, 156, 2070, 1, 0, 0, 0, 158, 2077, 1, 0, + 0, 0, 160, 2081, 1, 0, 0, 0, 162, 2095, 1, 0, 0, 0, 164, 2097, 1, 0, 0, + 0, 166, 2099, 1, 0, 0, 0, 168, 2101, 1, 0, 0, 0, 170, 2105, 1, 0, 0, 0, + 172, 2107, 1, 0, 0, 0, 174, 2109, 1, 0, 0, 0, 176, 2111, 1, 0, 0, 0, 178, + 2113, 1, 0, 0, 0, 180, 2118, 1, 0, 0, 0, 182, 2122, 1, 0, 0, 0, 184, 2124, + 1, 0, 0, 0, 186, 2126, 1, 0, 0, 0, 188, 2128, 1, 0, 0, 0, 190, 2130, 1, + 0, 0, 0, 192, 2132, 1, 0, 0, 0, 194, 2134, 1, 0, 0, 0, 196, 2136, 1, 0, + 0, 0, 198, 2138, 1, 0, 0, 0, 200, 2140, 1, 0, 0, 0, 202, 2142, 1, 0, 0, + 0, 204, 2144, 1, 0, 0, 0, 206, 2146, 1, 0, 0, 0, 208, 2148, 1, 0, 0, 0, + 210, 2150, 1, 0, 0, 0, 212, 2152, 1, 0, 0, 0, 214, 2154, 1, 0, 0, 0, 216, + 2156, 1, 0, 0, 0, 218, 2158, 1, 0, 0, 0, 220, 2160, 1, 0, 0, 0, 222, 2162, + 1, 0, 0, 0, 224, 2164, 1, 0, 0, 0, 226, 2166, 1, 0, 0, 0, 228, 2175, 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, 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, + 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, 117, 0, 0, 603, + 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, 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, + 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, 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, 1120, 1, 0, 0, 0, 1007, 1008, 10, 19, - 0, 0, 1008, 1009, 5, 11, 0, 0, 1009, 1119, 3, 68, 34, 20, 1010, 1011, 10, - 18, 0, 0, 1011, 1012, 7, 10, 0, 0, 1012, 1119, 3, 68, 34, 19, 1013, 1014, - 10, 17, 0, 0, 1014, 1015, 7, 4, 0, 0, 1015, 1119, 3, 68, 34, 18, 1016, - 1017, 10, 16, 0, 0, 1017, 1018, 7, 11, 0, 0, 1018, 1119, 3, 68, 34, 17, - 1019, 1020, 10, 15, 0, 0, 1020, 1021, 7, 12, 0, 0, 1021, 1119, 3, 68, 34, - 16, 1022, 1035, 10, 14, 0, 0, 1023, 1036, 5, 6, 0, 0, 1024, 1036, 5, 22, - 0, 0, 1025, 1036, 5, 23, 0, 0, 1026, 1036, 5, 24, 0, 0, 1027, 1036, 5, - 92, 0, 0, 1028, 1029, 5, 92, 0, 0, 1029, 1036, 5, 102, 0, 0, 1030, 1036, - 5, 83, 0, 0, 1031, 1036, 5, 97, 0, 0, 1032, 1036, 5, 77, 0, 0, 1033, 1036, - 5, 99, 0, 0, 1034, 1036, 5, 118, 0, 0, 1035, 1023, 1, 0, 0, 0, 1035, 1024, - 1, 0, 0, 0, 1035, 1025, 1, 0, 0, 0, 1035, 1026, 1, 0, 0, 0, 1035, 1027, - 1, 0, 0, 0, 1035, 1028, 1, 0, 0, 0, 1035, 1030, 1, 0, 0, 0, 1035, 1031, - 1, 0, 0, 0, 1035, 1032, 1, 0, 0, 0, 1035, 1033, 1, 0, 0, 0, 1035, 1034, - 1, 0, 0, 0, 1036, 1037, 1, 0, 0, 0, 1037, 1119, 3, 68, 34, 15, 1038, 1039, - 10, 12, 0, 0, 1039, 1040, 5, 32, 0, 0, 1040, 1119, 3, 68, 34, 13, 1041, - 1042, 10, 11, 0, 0, 1042, 1043, 5, 108, 0, 0, 1043, 1119, 3, 68, 34, 12, - 1044, 1046, 10, 4, 0, 0, 1045, 1047, 5, 102, 0, 0, 1046, 1045, 1, 0, 0, - 0, 1046, 1047, 1, 0, 0, 0, 1047, 1048, 1, 0, 0, 0, 1048, 1049, 5, 39, 0, - 0, 1049, 1050, 3, 68, 34, 0, 1050, 1051, 5, 32, 0, 0, 1051, 1052, 3, 68, - 34, 5, 1052, 1119, 1, 0, 0, 0, 1053, 1055, 10, 13, 0, 0, 1054, 1056, 5, - 102, 0, 0, 1055, 1054, 1, 0, 0, 0, 1055, 1056, 1, 0, 0, 0, 1056, 1057, - 1, 0, 0, 0, 1057, 1096, 5, 83, 0, 0, 1058, 1068, 5, 3, 0, 0, 1059, 1069, - 3, 84, 42, 0, 1060, 1065, 3, 68, 34, 0, 1061, 1062, 5, 5, 0, 0, 1062, 1064, - 3, 68, 34, 0, 1063, 1061, 1, 0, 0, 0, 1064, 1067, 1, 0, 0, 0, 1065, 1063, - 1, 0, 0, 0, 1065, 1066, 1, 0, 0, 0, 1066, 1069, 1, 0, 0, 0, 1067, 1065, - 1, 0, 0, 0, 1068, 1059, 1, 0, 0, 0, 1068, 1060, 1, 0, 0, 0, 1068, 1069, - 1, 0, 0, 0, 1069, 1070, 1, 0, 0, 0, 1070, 1097, 5, 4, 0, 0, 1071, 1072, - 3, 182, 91, 0, 1072, 1073, 5, 2, 0, 0, 1073, 1075, 1, 0, 0, 0, 1074, 1071, - 1, 0, 0, 0, 1074, 1075, 1, 0, 0, 0, 1075, 1076, 1, 0, 0, 0, 1076, 1097, - 3, 184, 92, 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, 1083, 3, 226, 113, 0, 1083, 1092, 5, 3, 0, 0, 1084, - 1089, 3, 68, 34, 0, 1085, 1086, 5, 5, 0, 0, 1086, 1088, 3, 68, 34, 0, 1087, - 1085, 1, 0, 0, 0, 1088, 1091, 1, 0, 0, 0, 1089, 1087, 1, 0, 0, 0, 1089, - 1090, 1, 0, 0, 0, 1090, 1093, 1, 0, 0, 0, 1091, 1089, 1, 0, 0, 0, 1092, - 1084, 1, 0, 0, 0, 1092, 1093, 1, 0, 0, 0, 1093, 1094, 1, 0, 0, 0, 1094, - 1095, 5, 4, 0, 0, 1095, 1097, 1, 0, 0, 0, 1096, 1058, 1, 0, 0, 0, 1096, - 1074, 1, 0, 0, 0, 1096, 1080, 1, 0, 0, 0, 1097, 1119, 1, 0, 0, 0, 1098, - 1099, 10, 7, 0, 0, 1099, 1100, 5, 45, 0, 0, 1100, 1119, 3, 192, 96, 0, - 1101, 1103, 10, 6, 0, 0, 1102, 1104, 5, 102, 0, 0, 1103, 1102, 1, 0, 0, - 0, 1103, 1104, 1, 0, 0, 0, 1104, 1105, 1, 0, 0, 0, 1105, 1106, 7, 13, 0, - 0, 1106, 1109, 3, 68, 34, 0, 1107, 1108, 5, 67, 0, 0, 1108, 1110, 3, 68, - 34, 0, 1109, 1107, 1, 0, 0, 0, 1109, 1110, 1, 0, 0, 0, 1110, 1119, 1, 0, - 0, 0, 1111, 1116, 10, 5, 0, 0, 1112, 1117, 5, 93, 0, 0, 1113, 1117, 5, - 103, 0, 0, 1114, 1115, 5, 102, 0, 0, 1115, 1117, 5, 104, 0, 0, 1116, 1112, - 1, 0, 0, 0, 1116, 1113, 1, 0, 0, 0, 1116, 1114, 1, 0, 0, 0, 1117, 1119, - 1, 0, 0, 0, 1118, 1007, 1, 0, 0, 0, 1118, 1010, 1, 0, 0, 0, 1118, 1013, - 1, 0, 0, 0, 1118, 1016, 1, 0, 0, 0, 1118, 1019, 1, 0, 0, 0, 1118, 1022, - 1, 0, 0, 0, 1118, 1038, 1, 0, 0, 0, 1118, 1041, 1, 0, 0, 0, 1118, 1044, - 1, 0, 0, 0, 1118, 1053, 1, 0, 0, 0, 1118, 1098, 1, 0, 0, 0, 1118, 1101, - 1, 0, 0, 0, 1118, 1111, 1, 0, 0, 0, 1119, 1122, 1, 0, 0, 0, 1120, 1118, - 1, 0, 0, 0, 1120, 1121, 1, 0, 0, 0, 1121, 69, 1, 0, 0, 0, 1122, 1120, 1, - 0, 0, 0, 1123, 1124, 5, 115, 0, 0, 1124, 1129, 5, 3, 0, 0, 1125, 1130, - 5, 81, 0, 0, 1126, 1127, 7, 14, 0, 0, 1127, 1128, 5, 5, 0, 0, 1128, 1130, - 3, 168, 84, 0, 1129, 1125, 1, 0, 0, 0, 1129, 1126, 1, 0, 0, 0, 1130, 1131, - 1, 0, 0, 0, 1131, 1132, 5, 4, 0, 0, 1132, 71, 1, 0, 0, 0, 1133, 1134, 7, - 15, 0, 0, 1134, 73, 1, 0, 0, 0, 1135, 1137, 3, 50, 25, 0, 1136, 1135, 1, - 0, 0, 0, 1136, 1137, 1, 0, 0, 0, 1137, 1143, 1, 0, 0, 0, 1138, 1144, 5, - 88, 0, 0, 1139, 1144, 5, 122, 0, 0, 1140, 1141, 5, 88, 0, 0, 1141, 1142, - 5, 108, 0, 0, 1142, 1144, 7, 8, 0, 0, 1143, 1138, 1, 0, 0, 0, 1143, 1139, - 1, 0, 0, 0, 1143, 1140, 1, 0, 0, 0, 1144, 1145, 1, 0, 0, 0, 1145, 1149, - 5, 91, 0, 0, 1146, 1147, 3, 182, 91, 0, 1147, 1148, 5, 2, 0, 0, 1148, 1150, - 1, 0, 0, 0, 1149, 1146, 1, 0, 0, 0, 1149, 1150, 1, 0, 0, 0, 1150, 1151, - 1, 0, 0, 0, 1151, 1154, 3, 184, 92, 0, 1152, 1153, 5, 33, 0, 0, 1153, 1155, - 3, 208, 104, 0, 1154, 1152, 1, 0, 0, 0, 1154, 1155, 1, 0, 0, 0, 1155, 1167, - 1, 0, 0, 0, 1156, 1157, 5, 3, 0, 0, 1157, 1162, 3, 190, 95, 0, 1158, 1159, - 5, 5, 0, 0, 1159, 1161, 3, 190, 95, 0, 1160, 1158, 1, 0, 0, 0, 1161, 1164, - 1, 0, 0, 0, 1162, 1160, 1, 0, 0, 0, 1162, 1163, 1, 0, 0, 0, 1163, 1165, - 1, 0, 0, 0, 1164, 1162, 1, 0, 0, 0, 1165, 1166, 5, 4, 0, 0, 1166, 1168, - 1, 0, 0, 0, 1167, 1156, 1, 0, 0, 0, 1167, 1168, 1, 0, 0, 0, 1168, 1198, - 1, 0, 0, 0, 1169, 1170, 5, 145, 0, 0, 1170, 1171, 5, 3, 0, 0, 1171, 1176, - 3, 68, 34, 0, 1172, 1173, 5, 5, 0, 0, 1173, 1175, 3, 68, 34, 0, 1174, 1172, - 1, 0, 0, 0, 1175, 1178, 1, 0, 0, 0, 1176, 1174, 1, 0, 0, 0, 1176, 1177, - 1, 0, 0, 0, 1177, 1179, 1, 0, 0, 0, 1178, 1176, 1, 0, 0, 0, 1179, 1194, - 5, 4, 0, 0, 1180, 1181, 5, 5, 0, 0, 1181, 1182, 5, 3, 0, 0, 1182, 1187, - 3, 68, 34, 0, 1183, 1184, 5, 5, 0, 0, 1184, 1186, 3, 68, 34, 0, 1185, 1183, - 1, 0, 0, 0, 1186, 1189, 1, 0, 0, 0, 1187, 1185, 1, 0, 0, 0, 1187, 1188, - 1, 0, 0, 0, 1188, 1190, 1, 0, 0, 0, 1189, 1187, 1, 0, 0, 0, 1190, 1191, - 5, 4, 0, 0, 1191, 1193, 1, 0, 0, 0, 1192, 1180, 1, 0, 0, 0, 1193, 1196, - 1, 0, 0, 0, 1194, 1192, 1, 0, 0, 0, 1194, 1195, 1, 0, 0, 0, 1195, 1199, - 1, 0, 0, 0, 1196, 1194, 1, 0, 0, 0, 1197, 1199, 3, 84, 42, 0, 1198, 1169, - 1, 0, 0, 0, 1198, 1197, 1, 0, 0, 0, 1199, 1201, 1, 0, 0, 0, 1200, 1202, - 3, 76, 38, 0, 1201, 1200, 1, 0, 0, 0, 1201, 1202, 1, 0, 0, 0, 1202, 1204, - 1, 0, 0, 0, 1203, 1205, 3, 58, 29, 0, 1204, 1203, 1, 0, 0, 0, 1204, 1205, - 1, 0, 0, 0, 1205, 1209, 1, 0, 0, 0, 1206, 1207, 5, 56, 0, 0, 1207, 1209, - 5, 145, 0, 0, 1208, 1136, 1, 0, 0, 0, 1208, 1206, 1, 0, 0, 0, 1209, 75, - 1, 0, 0, 0, 1210, 1211, 5, 107, 0, 0, 1211, 1226, 5, 48, 0, 0, 1212, 1213, - 5, 3, 0, 0, 1213, 1218, 3, 24, 12, 0, 1214, 1215, 5, 5, 0, 0, 1215, 1217, - 3, 24, 12, 0, 1216, 1214, 1, 0, 0, 0, 1217, 1220, 1, 0, 0, 0, 1218, 1216, - 1, 0, 0, 0, 1218, 1219, 1, 0, 0, 0, 1219, 1221, 1, 0, 0, 0, 1220, 1218, - 1, 0, 0, 0, 1221, 1224, 5, 4, 0, 0, 1222, 1223, 5, 149, 0, 0, 1223, 1225, - 3, 68, 34, 0, 1224, 1222, 1, 0, 0, 0, 1224, 1225, 1, 0, 0, 0, 1225, 1227, - 1, 0, 0, 0, 1226, 1212, 1, 0, 0, 0, 1226, 1227, 1, 0, 0, 0, 1227, 1228, - 1, 0, 0, 0, 1228, 1255, 5, 184, 0, 0, 1229, 1256, 5, 185, 0, 0, 1230, 1231, - 5, 142, 0, 0, 1231, 1234, 5, 131, 0, 0, 1232, 1235, 3, 190, 95, 0, 1233, - 1235, 3, 108, 54, 0, 1234, 1232, 1, 0, 0, 0, 1234, 1233, 1, 0, 0, 0, 1235, - 1236, 1, 0, 0, 0, 1236, 1237, 5, 6, 0, 0, 1237, 1248, 3, 68, 34, 0, 1238, - 1241, 5, 5, 0, 0, 1239, 1242, 3, 190, 95, 0, 1240, 1242, 3, 108, 54, 0, - 1241, 1239, 1, 0, 0, 0, 1241, 1240, 1, 0, 0, 0, 1242, 1243, 1, 0, 0, 0, - 1243, 1244, 5, 6, 0, 0, 1244, 1245, 3, 68, 34, 0, 1245, 1247, 1, 0, 0, - 0, 1246, 1238, 1, 0, 0, 0, 1247, 1250, 1, 0, 0, 0, 1248, 1246, 1, 0, 0, - 0, 1248, 1249, 1, 0, 0, 0, 1249, 1253, 1, 0, 0, 0, 1250, 1248, 1, 0, 0, - 0, 1251, 1252, 5, 149, 0, 0, 1252, 1254, 3, 68, 34, 0, 1253, 1251, 1, 0, - 0, 0, 1253, 1254, 1, 0, 0, 0, 1254, 1256, 1, 0, 0, 0, 1255, 1229, 1, 0, - 0, 0, 1255, 1230, 1, 0, 0, 0, 1256, 77, 1, 0, 0, 0, 1257, 1261, 5, 112, - 0, 0, 1258, 1259, 3, 182, 91, 0, 1259, 1260, 5, 2, 0, 0, 1260, 1262, 1, - 0, 0, 0, 1261, 1258, 1, 0, 0, 0, 1261, 1262, 1, 0, 0, 0, 1262, 1263, 1, - 0, 0, 0, 1263, 1270, 3, 204, 102, 0, 1264, 1265, 5, 6, 0, 0, 1265, 1271, - 3, 80, 40, 0, 1266, 1267, 5, 3, 0, 0, 1267, 1268, 3, 80, 40, 0, 1268, 1269, - 5, 4, 0, 0, 1269, 1271, 1, 0, 0, 0, 1270, 1264, 1, 0, 0, 0, 1270, 1266, - 1, 0, 0, 0, 1270, 1271, 1, 0, 0, 0, 1271, 79, 1, 0, 0, 0, 1272, 1276, 3, - 36, 18, 0, 1273, 1276, 3, 176, 88, 0, 1274, 1276, 5, 190, 0, 0, 1275, 1272, - 1, 0, 0, 0, 1275, 1273, 1, 0, 0, 0, 1275, 1274, 1, 0, 0, 0, 1276, 81, 1, - 0, 0, 0, 1277, 1288, 5, 119, 0, 0, 1278, 1289, 3, 192, 96, 0, 1279, 1280, - 3, 182, 91, 0, 1280, 1281, 5, 2, 0, 0, 1281, 1283, 1, 0, 0, 0, 1282, 1279, - 1, 0, 0, 0, 1282, 1283, 1, 0, 0, 0, 1283, 1286, 1, 0, 0, 0, 1284, 1287, - 3, 184, 92, 0, 1285, 1287, 3, 196, 98, 0, 1286, 1284, 1, 0, 0, 0, 1286, - 1285, 1, 0, 0, 0, 1287, 1289, 1, 0, 0, 0, 1288, 1278, 1, 0, 0, 0, 1288, - 1282, 1, 0, 0, 0, 1288, 1289, 1, 0, 0, 0, 1289, 83, 1, 0, 0, 0, 1290, 1292, - 3, 132, 66, 0, 1291, 1290, 1, 0, 0, 0, 1291, 1292, 1, 0, 0, 0, 1292, 1293, - 1, 0, 0, 0, 1293, 1299, 3, 88, 44, 0, 1294, 1295, 3, 104, 52, 0, 1295, - 1296, 3, 88, 44, 0, 1296, 1298, 1, 0, 0, 0, 1297, 1294, 1, 0, 0, 0, 1298, - 1301, 1, 0, 0, 0, 1299, 1297, 1, 0, 0, 0, 1299, 1300, 1, 0, 0, 0, 1300, - 1303, 1, 0, 0, 0, 1301, 1299, 1, 0, 0, 0, 1302, 1304, 3, 134, 67, 0, 1303, - 1302, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1306, 1, 0, 0, 0, 1305, - 1307, 3, 136, 68, 0, 1306, 1305, 1, 0, 0, 0, 1306, 1307, 1, 0, 0, 0, 1307, - 85, 1, 0, 0, 0, 1308, 1316, 3, 96, 48, 0, 1309, 1310, 3, 100, 50, 0, 1310, - 1312, 3, 96, 48, 0, 1311, 1313, 3, 102, 51, 0, 1312, 1311, 1, 0, 0, 0, - 1312, 1313, 1, 0, 0, 0, 1313, 1315, 1, 0, 0, 0, 1314, 1309, 1, 0, 0, 0, - 1315, 1318, 1, 0, 0, 0, 1316, 1314, 1, 0, 0, 0, 1316, 1317, 1, 0, 0, 0, - 1317, 87, 1, 0, 0, 0, 1318, 1316, 1, 0, 0, 0, 1319, 1321, 5, 130, 0, 0, - 1320, 1322, 7, 16, 0, 0, 1321, 1320, 1, 0, 0, 0, 1321, 1322, 1, 0, 0, 0, - 1322, 1323, 1, 0, 0, 0, 1323, 1328, 3, 98, 49, 0, 1324, 1325, 5, 5, 0, - 0, 1325, 1327, 3, 98, 49, 0, 1326, 1324, 1, 0, 0, 0, 1327, 1330, 1, 0, - 0, 0, 1328, 1326, 1, 0, 0, 0, 1328, 1329, 1, 0, 0, 0, 1329, 1343, 1, 0, - 0, 0, 1330, 1328, 1, 0, 0, 0, 1331, 1341, 5, 75, 0, 0, 1332, 1337, 3, 96, - 48, 0, 1333, 1334, 5, 5, 0, 0, 1334, 1336, 3, 96, 48, 0, 1335, 1333, 1, - 0, 0, 0, 1336, 1339, 1, 0, 0, 0, 1337, 1335, 1, 0, 0, 0, 1337, 1338, 1, - 0, 0, 0, 1338, 1342, 1, 0, 0, 0, 1339, 1337, 1, 0, 0, 0, 1340, 1342, 3, - 86, 43, 0, 1341, 1332, 1, 0, 0, 0, 1341, 1340, 1, 0, 0, 0, 1342, 1344, - 1, 0, 0, 0, 1343, 1331, 1, 0, 0, 0, 1343, 1344, 1, 0, 0, 0, 1344, 1347, - 1, 0, 0, 0, 1345, 1346, 5, 149, 0, 0, 1346, 1348, 3, 68, 34, 0, 1347, 1345, - 1, 0, 0, 0, 1347, 1348, 1, 0, 0, 0, 1348, 1363, 1, 0, 0, 0, 1349, 1350, - 5, 78, 0, 0, 1350, 1351, 5, 40, 0, 0, 1351, 1356, 3, 68, 34, 0, 1352, 1353, - 5, 5, 0, 0, 1353, 1355, 3, 68, 34, 0, 1354, 1352, 1, 0, 0, 0, 1355, 1358, - 1, 0, 0, 0, 1356, 1354, 1, 0, 0, 0, 1356, 1357, 1, 0, 0, 0, 1357, 1361, - 1, 0, 0, 0, 1358, 1356, 1, 0, 0, 0, 1359, 1360, 5, 79, 0, 0, 1360, 1362, - 3, 68, 34, 0, 1361, 1359, 1, 0, 0, 0, 1361, 1362, 1, 0, 0, 0, 1362, 1364, - 1, 0, 0, 0, 1363, 1349, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, 1379, - 1, 0, 0, 0, 1365, 1366, 5, 175, 0, 0, 1366, 1367, 3, 214, 107, 0, 1367, - 1368, 5, 33, 0, 0, 1368, 1376, 3, 118, 59, 0, 1369, 1370, 5, 5, 0, 0, 1370, - 1371, 3, 214, 107, 0, 1371, 1372, 5, 33, 0, 0, 1372, 1373, 3, 118, 59, - 0, 1373, 1375, 1, 0, 0, 0, 1374, 1369, 1, 0, 0, 0, 1375, 1378, 1, 0, 0, - 0, 1376, 1374, 1, 0, 0, 0, 1376, 1377, 1, 0, 0, 0, 1377, 1380, 1, 0, 0, - 0, 1378, 1376, 1, 0, 0, 0, 1379, 1365, 1, 0, 0, 0, 1379, 1380, 1, 0, 0, - 0, 1380, 1410, 1, 0, 0, 0, 1381, 1382, 5, 145, 0, 0, 1382, 1383, 5, 3, - 0, 0, 1383, 1388, 3, 68, 34, 0, 1384, 1385, 5, 5, 0, 0, 1385, 1387, 3, - 68, 34, 0, 1386, 1384, 1, 0, 0, 0, 1387, 1390, 1, 0, 0, 0, 1388, 1386, - 1, 0, 0, 0, 1388, 1389, 1, 0, 0, 0, 1389, 1391, 1, 0, 0, 0, 1390, 1388, - 1, 0, 0, 0, 1391, 1406, 5, 4, 0, 0, 1392, 1393, 5, 5, 0, 0, 1393, 1394, - 5, 3, 0, 0, 1394, 1399, 3, 68, 34, 0, 1395, 1396, 5, 5, 0, 0, 1396, 1398, - 3, 68, 34, 0, 1397, 1395, 1, 0, 0, 0, 1398, 1401, 1, 0, 0, 0, 1399, 1397, - 1, 0, 0, 0, 1399, 1400, 1, 0, 0, 0, 1400, 1402, 1, 0, 0, 0, 1401, 1399, - 1, 0, 0, 0, 1402, 1403, 5, 4, 0, 0, 1403, 1405, 1, 0, 0, 0, 1404, 1392, - 1, 0, 0, 0, 1405, 1408, 1, 0, 0, 0, 1406, 1404, 1, 0, 0, 0, 1406, 1407, - 1, 0, 0, 0, 1407, 1410, 1, 0, 0, 0, 1408, 1406, 1, 0, 0, 0, 1409, 1319, - 1, 0, 0, 0, 1409, 1381, 1, 0, 0, 0, 1410, 89, 1, 0, 0, 0, 1411, 1412, 3, - 84, 42, 0, 1412, 91, 1, 0, 0, 0, 1413, 1415, 3, 132, 66, 0, 1414, 1413, - 1, 0, 0, 0, 1414, 1415, 1, 0, 0, 0, 1415, 1416, 1, 0, 0, 0, 1416, 1418, - 3, 88, 44, 0, 1417, 1419, 3, 134, 67, 0, 1418, 1417, 1, 0, 0, 0, 1418, - 1419, 1, 0, 0, 0, 1419, 1421, 1, 0, 0, 0, 1420, 1422, 3, 136, 68, 0, 1421, - 1420, 1, 0, 0, 0, 1421, 1422, 1, 0, 0, 0, 1422, 93, 1, 0, 0, 0, 1423, 1425, - 3, 132, 66, 0, 1424, 1423, 1, 0, 0, 0, 1424, 1425, 1, 0, 0, 0, 1425, 1426, - 1, 0, 0, 0, 1426, 1436, 3, 88, 44, 0, 1427, 1429, 5, 140, 0, 0, 1428, 1430, - 5, 29, 0, 0, 1429, 1428, 1, 0, 0, 0, 1429, 1430, 1, 0, 0, 0, 1430, 1434, - 1, 0, 0, 0, 1431, 1434, 5, 90, 0, 0, 1432, 1434, 5, 68, 0, 0, 1433, 1427, - 1, 0, 0, 0, 1433, 1431, 1, 0, 0, 0, 1433, 1432, 1, 0, 0, 0, 1434, 1435, - 1, 0, 0, 0, 1435, 1437, 3, 88, 44, 0, 1436, 1433, 1, 0, 0, 0, 1437, 1438, - 1, 0, 0, 0, 1438, 1436, 1, 0, 0, 0, 1438, 1439, 1, 0, 0, 0, 1439, 1441, - 1, 0, 0, 0, 1440, 1442, 3, 134, 67, 0, 1441, 1440, 1, 0, 0, 0, 1441, 1442, - 1, 0, 0, 0, 1442, 1444, 1, 0, 0, 0, 1443, 1445, 3, 136, 68, 0, 1444, 1443, - 1, 0, 0, 0, 1444, 1445, 1, 0, 0, 0, 1445, 95, 1, 0, 0, 0, 1446, 1447, 3, - 182, 91, 0, 1447, 1448, 5, 2, 0, 0, 1448, 1450, 1, 0, 0, 0, 1449, 1446, - 1, 0, 0, 0, 1449, 1450, 1, 0, 0, 0, 1450, 1451, 1, 0, 0, 0, 1451, 1456, - 3, 184, 92, 0, 1452, 1454, 5, 33, 0, 0, 1453, 1452, 1, 0, 0, 0, 1453, 1454, - 1, 0, 0, 0, 1454, 1455, 1, 0, 0, 0, 1455, 1457, 3, 208, 104, 0, 1456, 1453, - 1, 0, 0, 0, 1456, 1457, 1, 0, 0, 0, 1457, 1463, 1, 0, 0, 0, 1458, 1459, - 5, 85, 0, 0, 1459, 1460, 5, 40, 0, 0, 1460, 1464, 3, 196, 98, 0, 1461, - 1462, 5, 102, 0, 0, 1462, 1464, 5, 85, 0, 0, 1463, 1458, 1, 0, 0, 0, 1463, - 1461, 1, 0, 0, 0, 1463, 1464, 1, 0, 0, 0, 1464, 1575, 1, 0, 0, 0, 1465, - 1466, 3, 182, 91, 0, 1466, 1467, 5, 2, 0, 0, 1467, 1469, 1, 0, 0, 0, 1468, - 1465, 1, 0, 0, 0, 1468, 1469, 1, 0, 0, 0, 1469, 1470, 1, 0, 0, 0, 1470, - 1471, 3, 226, 113, 0, 1471, 1472, 5, 3, 0, 0, 1472, 1477, 3, 68, 34, 0, - 1473, 1474, 5, 5, 0, 0, 1474, 1476, 3, 68, 34, 0, 1475, 1473, 1, 0, 0, - 0, 1476, 1479, 1, 0, 0, 0, 1477, 1475, 1, 0, 0, 0, 1477, 1478, 1, 0, 0, - 0, 1478, 1480, 1, 0, 0, 0, 1479, 1477, 1, 0, 0, 0, 1480, 1485, 5, 4, 0, - 0, 1481, 1483, 5, 33, 0, 0, 1482, 1481, 1, 0, 0, 0, 1482, 1483, 1, 0, 0, - 0, 1483, 1484, 1, 0, 0, 0, 1484, 1486, 3, 208, 104, 0, 1485, 1482, 1, 0, - 0, 0, 1485, 1486, 1, 0, 0, 0, 1486, 1575, 1, 0, 0, 0, 1487, 1497, 5, 3, - 0, 0, 1488, 1493, 3, 96, 48, 0, 1489, 1490, 5, 5, 0, 0, 1490, 1492, 3, - 96, 48, 0, 1491, 1489, 1, 0, 0, 0, 1492, 1495, 1, 0, 0, 0, 1493, 1491, - 1, 0, 0, 0, 1493, 1494, 1, 0, 0, 0, 1494, 1498, 1, 0, 0, 0, 1495, 1493, - 1, 0, 0, 0, 1496, 1498, 3, 86, 43, 0, 1497, 1488, 1, 0, 0, 0, 1497, 1496, - 1, 0, 0, 0, 1498, 1499, 1, 0, 0, 0, 1499, 1500, 5, 4, 0, 0, 1500, 1575, - 1, 0, 0, 0, 1501, 1502, 5, 3, 0, 0, 1502, 1503, 3, 84, 42, 0, 1503, 1508, - 5, 4, 0, 0, 1504, 1506, 5, 33, 0, 0, 1505, 1504, 1, 0, 0, 0, 1505, 1506, - 1, 0, 0, 0, 1506, 1507, 1, 0, 0, 0, 1507, 1509, 3, 208, 104, 0, 1508, 1505, - 1, 0, 0, 0, 1508, 1509, 1, 0, 0, 0, 1509, 1575, 1, 0, 0, 0, 1510, 1511, - 3, 182, 91, 0, 1511, 1512, 5, 2, 0, 0, 1512, 1514, 1, 0, 0, 0, 1513, 1510, - 1, 0, 0, 0, 1513, 1514, 1, 0, 0, 0, 1514, 1515, 1, 0, 0, 0, 1515, 1520, - 3, 184, 92, 0, 1516, 1518, 5, 33, 0, 0, 1517, 1516, 1, 0, 0, 0, 1517, 1518, - 1, 0, 0, 0, 1518, 1519, 1, 0, 0, 0, 1519, 1521, 3, 210, 105, 0, 1520, 1517, - 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1527, 1, 0, 0, 0, 1522, 1523, - 5, 85, 0, 0, 1523, 1524, 5, 40, 0, 0, 1524, 1528, 3, 196, 98, 0, 1525, - 1526, 5, 102, 0, 0, 1526, 1528, 5, 85, 0, 0, 1527, 1522, 1, 0, 0, 0, 1527, - 1525, 1, 0, 0, 0, 1527, 1528, 1, 0, 0, 0, 1528, 1575, 1, 0, 0, 0, 1529, - 1530, 3, 182, 91, 0, 1530, 1531, 5, 2, 0, 0, 1531, 1533, 1, 0, 0, 0, 1532, - 1529, 1, 0, 0, 0, 1532, 1533, 1, 0, 0, 0, 1533, 1534, 1, 0, 0, 0, 1534, - 1535, 3, 226, 113, 0, 1535, 1536, 5, 3, 0, 0, 1536, 1541, 3, 68, 34, 0, - 1537, 1538, 5, 5, 0, 0, 1538, 1540, 3, 68, 34, 0, 1539, 1537, 1, 0, 0, - 0, 1540, 1543, 1, 0, 0, 0, 1541, 1539, 1, 0, 0, 0, 1541, 1542, 1, 0, 0, - 0, 1542, 1544, 1, 0, 0, 0, 1543, 1541, 1, 0, 0, 0, 1544, 1549, 5, 4, 0, - 0, 1545, 1547, 5, 33, 0, 0, 1546, 1545, 1, 0, 0, 0, 1546, 1547, 1, 0, 0, - 0, 1547, 1548, 1, 0, 0, 0, 1548, 1550, 3, 210, 105, 0, 1549, 1546, 1, 0, - 0, 0, 1549, 1550, 1, 0, 0, 0, 1550, 1575, 1, 0, 0, 0, 1551, 1561, 5, 3, - 0, 0, 1552, 1557, 3, 96, 48, 0, 1553, 1554, 5, 5, 0, 0, 1554, 1556, 3, - 96, 48, 0, 1555, 1553, 1, 0, 0, 0, 1556, 1559, 1, 0, 0, 0, 1557, 1555, - 1, 0, 0, 0, 1557, 1558, 1, 0, 0, 0, 1558, 1562, 1, 0, 0, 0, 1559, 1557, - 1, 0, 0, 0, 1560, 1562, 3, 86, 43, 0, 1561, 1552, 1, 0, 0, 0, 1561, 1560, - 1, 0, 0, 0, 1562, 1563, 1, 0, 0, 0, 1563, 1564, 5, 4, 0, 0, 1564, 1575, - 1, 0, 0, 0, 1565, 1566, 5, 3, 0, 0, 1566, 1567, 3, 84, 42, 0, 1567, 1572, - 5, 4, 0, 0, 1568, 1570, 5, 33, 0, 0, 1569, 1568, 1, 0, 0, 0, 1569, 1570, - 1, 0, 0, 0, 1570, 1571, 1, 0, 0, 0, 1571, 1573, 3, 210, 105, 0, 1572, 1569, - 1, 0, 0, 0, 1572, 1573, 1, 0, 0, 0, 1573, 1575, 1, 0, 0, 0, 1574, 1449, - 1, 0, 0, 0, 1574, 1468, 1, 0, 0, 0, 1574, 1487, 1, 0, 0, 0, 1574, 1501, - 1, 0, 0, 0, 1574, 1513, 1, 0, 0, 0, 1574, 1532, 1, 0, 0, 0, 1574, 1551, - 1, 0, 0, 0, 1574, 1565, 1, 0, 0, 0, 1575, 97, 1, 0, 0, 0, 1576, 1589, 5, - 7, 0, 0, 1577, 1578, 3, 184, 92, 0, 1578, 1579, 5, 2, 0, 0, 1579, 1580, - 5, 7, 0, 0, 1580, 1589, 1, 0, 0, 0, 1581, 1586, 3, 68, 34, 0, 1582, 1584, - 5, 33, 0, 0, 1583, 1582, 1, 0, 0, 0, 1583, 1584, 1, 0, 0, 0, 1584, 1585, - 1, 0, 0, 0, 1585, 1587, 3, 172, 86, 0, 1586, 1583, 1, 0, 0, 0, 1586, 1587, - 1, 0, 0, 0, 1587, 1589, 1, 0, 0, 0, 1588, 1576, 1, 0, 0, 0, 1588, 1577, - 1, 0, 0, 0, 1588, 1581, 1, 0, 0, 0, 1589, 99, 1, 0, 0, 0, 1590, 1605, 5, - 5, 0, 0, 1591, 1593, 5, 100, 0, 0, 1592, 1591, 1, 0, 0, 0, 1592, 1593, - 1, 0, 0, 0, 1593, 1599, 1, 0, 0, 0, 1594, 1596, 7, 17, 0, 0, 1595, 1597, - 5, 110, 0, 0, 1596, 1595, 1, 0, 0, 0, 1596, 1597, 1, 0, 0, 0, 1597, 1600, - 1, 0, 0, 0, 1598, 1600, 5, 87, 0, 0, 1599, 1594, 1, 0, 0, 0, 1599, 1598, - 1, 0, 0, 0, 1599, 1600, 1, 0, 0, 0, 1600, 1601, 1, 0, 0, 0, 1601, 1605, - 5, 94, 0, 0, 1602, 1603, 5, 51, 0, 0, 1603, 1605, 5, 94, 0, 0, 1604, 1590, - 1, 0, 0, 0, 1604, 1592, 1, 0, 0, 0, 1604, 1602, 1, 0, 0, 0, 1605, 101, - 1, 0, 0, 0, 1606, 1607, 5, 107, 0, 0, 1607, 1621, 3, 68, 34, 0, 1608, 1609, - 5, 143, 0, 0, 1609, 1610, 5, 3, 0, 0, 1610, 1615, 3, 190, 95, 0, 1611, - 1612, 5, 5, 0, 0, 1612, 1614, 3, 190, 95, 0, 1613, 1611, 1, 0, 0, 0, 1614, - 1617, 1, 0, 0, 0, 1615, 1613, 1, 0, 0, 0, 1615, 1616, 1, 0, 0, 0, 1616, - 1618, 1, 0, 0, 0, 1617, 1615, 1, 0, 0, 0, 1618, 1619, 5, 4, 0, 0, 1619, - 1621, 1, 0, 0, 0, 1620, 1606, 1, 0, 0, 0, 1620, 1608, 1, 0, 0, 0, 1621, - 103, 1, 0, 0, 0, 1622, 1624, 5, 140, 0, 0, 1623, 1625, 5, 29, 0, 0, 1624, - 1623, 1, 0, 0, 0, 1624, 1625, 1, 0, 0, 0, 1625, 1629, 1, 0, 0, 0, 1626, - 1629, 5, 90, 0, 0, 1627, 1629, 5, 68, 0, 0, 1628, 1622, 1, 0, 0, 0, 1628, - 1626, 1, 0, 0, 0, 1628, 1627, 1, 0, 0, 0, 1629, 105, 1, 0, 0, 0, 1630, - 1632, 3, 50, 25, 0, 1631, 1630, 1, 0, 0, 0, 1631, 1632, 1, 0, 0, 0, 1632, - 1633, 1, 0, 0, 0, 1633, 1636, 5, 142, 0, 0, 1634, 1635, 5, 108, 0, 0, 1635, - 1637, 7, 8, 0, 0, 1636, 1634, 1, 0, 0, 0, 1636, 1637, 1, 0, 0, 0, 1637, - 1638, 1, 0, 0, 0, 1638, 1639, 3, 112, 56, 0, 1639, 1642, 5, 131, 0, 0, - 1640, 1643, 3, 190, 95, 0, 1641, 1643, 3, 108, 54, 0, 1642, 1640, 1, 0, - 0, 0, 1642, 1641, 1, 0, 0, 0, 1643, 1644, 1, 0, 0, 0, 1644, 1645, 5, 6, - 0, 0, 1645, 1656, 3, 68, 34, 0, 1646, 1649, 5, 5, 0, 0, 1647, 1650, 3, - 190, 95, 0, 1648, 1650, 3, 108, 54, 0, 1649, 1647, 1, 0, 0, 0, 1649, 1648, - 1, 0, 0, 0, 1650, 1651, 1, 0, 0, 0, 1651, 1652, 5, 6, 0, 0, 1652, 1653, - 3, 68, 34, 0, 1653, 1655, 1, 0, 0, 0, 1654, 1646, 1, 0, 0, 0, 1655, 1658, - 1, 0, 0, 0, 1656, 1654, 1, 0, 0, 0, 1656, 1657, 1, 0, 0, 0, 1657, 1661, - 1, 0, 0, 0, 1658, 1656, 1, 0, 0, 0, 1659, 1660, 5, 149, 0, 0, 1660, 1662, - 3, 68, 34, 0, 1661, 1659, 1, 0, 0, 0, 1661, 1662, 1, 0, 0, 0, 1662, 1664, - 1, 0, 0, 0, 1663, 1665, 3, 58, 29, 0, 1664, 1663, 1, 0, 0, 0, 1664, 1665, - 1, 0, 0, 0, 1665, 107, 1, 0, 0, 0, 1666, 1667, 5, 3, 0, 0, 1667, 1672, - 3, 190, 95, 0, 1668, 1669, 5, 5, 0, 0, 1669, 1671, 3, 190, 95, 0, 1670, - 1668, 1, 0, 0, 0, 1671, 1674, 1, 0, 0, 0, 1672, 1670, 1, 0, 0, 0, 1672, - 1673, 1, 0, 0, 0, 1673, 1675, 1, 0, 0, 0, 1674, 1672, 1, 0, 0, 0, 1675, - 1676, 5, 4, 0, 0, 1676, 109, 1, 0, 0, 0, 1677, 1679, 3, 50, 25, 0, 1678, - 1677, 1, 0, 0, 0, 1678, 1679, 1, 0, 0, 0, 1679, 1680, 1, 0, 0, 0, 1680, - 1683, 5, 142, 0, 0, 1681, 1682, 5, 108, 0, 0, 1682, 1684, 7, 8, 0, 0, 1683, - 1681, 1, 0, 0, 0, 1683, 1684, 1, 0, 0, 0, 1684, 1685, 1, 0, 0, 0, 1685, - 1686, 3, 112, 56, 0, 1686, 1689, 5, 131, 0, 0, 1687, 1690, 3, 190, 95, - 0, 1688, 1690, 3, 108, 54, 0, 1689, 1687, 1, 0, 0, 0, 1689, 1688, 1, 0, - 0, 0, 1690, 1691, 1, 0, 0, 0, 1691, 1692, 5, 6, 0, 0, 1692, 1703, 3, 68, - 34, 0, 1693, 1696, 5, 5, 0, 0, 1694, 1697, 3, 190, 95, 0, 1695, 1697, 3, - 108, 54, 0, 1696, 1694, 1, 0, 0, 0, 1696, 1695, 1, 0, 0, 0, 1697, 1698, - 1, 0, 0, 0, 1698, 1699, 5, 6, 0, 0, 1699, 1700, 3, 68, 34, 0, 1700, 1702, - 1, 0, 0, 0, 1701, 1693, 1, 0, 0, 0, 1702, 1705, 1, 0, 0, 0, 1703, 1701, - 1, 0, 0, 0, 1703, 1704, 1, 0, 0, 0, 1704, 1708, 1, 0, 0, 0, 1705, 1703, - 1, 0, 0, 0, 1706, 1707, 5, 149, 0, 0, 1707, 1709, 3, 68, 34, 0, 1708, 1706, - 1, 0, 0, 0, 1708, 1709, 1, 0, 0, 0, 1709, 1714, 1, 0, 0, 0, 1710, 1712, - 3, 134, 67, 0, 1711, 1710, 1, 0, 0, 0, 1711, 1712, 1, 0, 0, 0, 1712, 1713, - 1, 0, 0, 0, 1713, 1715, 3, 136, 68, 0, 1714, 1711, 1, 0, 0, 0, 1714, 1715, - 1, 0, 0, 0, 1715, 111, 1, 0, 0, 0, 1716, 1717, 3, 182, 91, 0, 1717, 1718, - 5, 2, 0, 0, 1718, 1720, 1, 0, 0, 0, 1719, 1716, 1, 0, 0, 0, 1719, 1720, - 1, 0, 0, 0, 1720, 1721, 1, 0, 0, 0, 1721, 1724, 3, 184, 92, 0, 1722, 1723, - 5, 33, 0, 0, 1723, 1725, 3, 216, 108, 0, 1724, 1722, 1, 0, 0, 0, 1724, - 1725, 1, 0, 0, 0, 1725, 1731, 1, 0, 0, 0, 1726, 1727, 5, 85, 0, 0, 1727, - 1728, 5, 40, 0, 0, 1728, 1732, 3, 196, 98, 0, 1729, 1730, 5, 102, 0, 0, - 1730, 1732, 5, 85, 0, 0, 1731, 1726, 1, 0, 0, 0, 1731, 1729, 1, 0, 0, 0, - 1731, 1732, 1, 0, 0, 0, 1732, 113, 1, 0, 0, 0, 1733, 1735, 5, 144, 0, 0, - 1734, 1736, 3, 182, 91, 0, 1735, 1734, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, - 0, 1736, 1739, 1, 0, 0, 0, 1737, 1738, 5, 91, 0, 0, 1738, 1740, 3, 218, - 109, 0, 1739, 1737, 1, 0, 0, 0, 1739, 1740, 1, 0, 0, 0, 1740, 115, 1, 0, - 0, 0, 1741, 1742, 5, 179, 0, 0, 1742, 1743, 5, 3, 0, 0, 1743, 1744, 5, - 149, 0, 0, 1744, 1745, 3, 68, 34, 0, 1745, 1746, 5, 4, 0, 0, 1746, 117, - 1, 0, 0, 0, 1747, 1749, 5, 3, 0, 0, 1748, 1750, 3, 220, 110, 0, 1749, 1748, - 1, 0, 0, 0, 1749, 1750, 1, 0, 0, 0, 1750, 1761, 1, 0, 0, 0, 1751, 1752, - 5, 154, 0, 0, 1752, 1753, 5, 40, 0, 0, 1753, 1758, 3, 68, 34, 0, 1754, - 1755, 5, 5, 0, 0, 1755, 1757, 3, 68, 34, 0, 1756, 1754, 1, 0, 0, 0, 1757, - 1760, 1, 0, 0, 0, 1758, 1756, 1, 0, 0, 0, 1758, 1759, 1, 0, 0, 0, 1759, - 1762, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1761, 1751, 1, 0, 0, 0, 1761, - 1762, 1, 0, 0, 0, 1762, 1763, 1, 0, 0, 0, 1763, 1764, 5, 109, 0, 0, 1764, - 1765, 5, 40, 0, 0, 1765, 1770, 3, 138, 69, 0, 1766, 1767, 5, 5, 0, 0, 1767, - 1769, 3, 138, 69, 0, 1768, 1766, 1, 0, 0, 0, 1769, 1772, 1, 0, 0, 0, 1770, - 1768, 1, 0, 0, 0, 1770, 1771, 1, 0, 0, 0, 1771, 1774, 1, 0, 0, 0, 1772, - 1770, 1, 0, 0, 0, 1773, 1775, 3, 122, 61, 0, 1774, 1773, 1, 0, 0, 0, 1774, - 1775, 1, 0, 0, 0, 1775, 1776, 1, 0, 0, 0, 1776, 1777, 5, 4, 0, 0, 1777, - 119, 1, 0, 0, 0, 1778, 1812, 5, 153, 0, 0, 1779, 1813, 3, 214, 107, 0, - 1780, 1782, 5, 3, 0, 0, 1781, 1783, 3, 220, 110, 0, 1782, 1781, 1, 0, 0, - 0, 1782, 1783, 1, 0, 0, 0, 1783, 1794, 1, 0, 0, 0, 1784, 1785, 5, 154, - 0, 0, 1785, 1786, 5, 40, 0, 0, 1786, 1791, 3, 68, 34, 0, 1787, 1788, 5, - 5, 0, 0, 1788, 1790, 3, 68, 34, 0, 1789, 1787, 1, 0, 0, 0, 1790, 1793, - 1, 0, 0, 0, 1791, 1789, 1, 0, 0, 0, 1791, 1792, 1, 0, 0, 0, 1792, 1795, - 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1794, 1784, 1, 0, 0, 0, 1794, 1795, - 1, 0, 0, 0, 1795, 1806, 1, 0, 0, 0, 1796, 1797, 5, 109, 0, 0, 1797, 1798, - 5, 40, 0, 0, 1798, 1803, 3, 138, 69, 0, 1799, 1800, 5, 5, 0, 0, 1800, 1802, - 3, 138, 69, 0, 1801, 1799, 1, 0, 0, 0, 1802, 1805, 1, 0, 0, 0, 1803, 1801, - 1, 0, 0, 0, 1803, 1804, 1, 0, 0, 0, 1804, 1807, 1, 0, 0, 0, 1805, 1803, - 1, 0, 0, 0, 1806, 1796, 1, 0, 0, 0, 1806, 1807, 1, 0, 0, 0, 1807, 1809, - 1, 0, 0, 0, 1808, 1810, 3, 122, 61, 0, 1809, 1808, 1, 0, 0, 0, 1809, 1810, - 1, 0, 0, 0, 1810, 1811, 1, 0, 0, 0, 1811, 1813, 5, 4, 0, 0, 1812, 1779, - 1, 0, 0, 0, 1812, 1780, 1, 0, 0, 0, 1813, 121, 1, 0, 0, 0, 1814, 1822, - 3, 124, 62, 0, 1815, 1816, 5, 181, 0, 0, 1816, 1817, 5, 101, 0, 0, 1817, - 1823, 5, 183, 0, 0, 1818, 1819, 5, 158, 0, 0, 1819, 1823, 5, 127, 0, 0, - 1820, 1823, 5, 78, 0, 0, 1821, 1823, 5, 182, 0, 0, 1822, 1815, 1, 0, 0, - 0, 1822, 1818, 1, 0, 0, 0, 1822, 1820, 1, 0, 0, 0, 1822, 1821, 1, 0, 0, - 0, 1822, 1823, 1, 0, 0, 0, 1823, 123, 1, 0, 0, 0, 1824, 1831, 7, 18, 0, - 0, 1825, 1832, 3, 146, 73, 0, 1826, 1827, 5, 39, 0, 0, 1827, 1828, 3, 142, - 71, 0, 1828, 1829, 5, 32, 0, 0, 1829, 1830, 3, 144, 72, 0, 1830, 1832, - 1, 0, 0, 0, 1831, 1825, 1, 0, 0, 0, 1831, 1826, 1, 0, 0, 0, 1832, 125, - 1, 0, 0, 0, 1833, 1834, 3, 222, 111, 0, 1834, 1844, 5, 3, 0, 0, 1835, 1840, - 3, 68, 34, 0, 1836, 1837, 5, 5, 0, 0, 1837, 1839, 3, 68, 34, 0, 1838, 1836, - 1, 0, 0, 0, 1839, 1842, 1, 0, 0, 0, 1840, 1838, 1, 0, 0, 0, 1840, 1841, - 1, 0, 0, 0, 1841, 1845, 1, 0, 0, 0, 1842, 1840, 1, 0, 0, 0, 1843, 1845, - 5, 7, 0, 0, 1844, 1835, 1, 0, 0, 0, 1844, 1843, 1, 0, 0, 0, 1845, 1846, - 1, 0, 0, 0, 1846, 1847, 5, 4, 0, 0, 1847, 127, 1, 0, 0, 0, 1848, 1849, - 3, 224, 112, 0, 1849, 1862, 5, 3, 0, 0, 1850, 1852, 5, 62, 0, 0, 1851, - 1850, 1, 0, 0, 0, 1851, 1852, 1, 0, 0, 0, 1852, 1853, 1, 0, 0, 0, 1853, - 1858, 3, 68, 34, 0, 1854, 1855, 5, 5, 0, 0, 1855, 1857, 3, 68, 34, 0, 1856, - 1854, 1, 0, 0, 0, 1857, 1860, 1, 0, 0, 0, 1858, 1856, 1, 0, 0, 0, 1858, - 1859, 1, 0, 0, 0, 1859, 1863, 1, 0, 0, 0, 1860, 1858, 1, 0, 0, 0, 1861, - 1863, 5, 7, 0, 0, 1862, 1851, 1, 0, 0, 0, 1862, 1861, 1, 0, 0, 0, 1862, - 1863, 1, 0, 0, 0, 1863, 1864, 1, 0, 0, 0, 1864, 1866, 5, 4, 0, 0, 1865, - 1867, 3, 116, 58, 0, 1866, 1865, 1, 0, 0, 0, 1866, 1867, 1, 0, 0, 0, 1867, - 129, 1, 0, 0, 0, 1868, 1869, 3, 148, 74, 0, 1869, 1879, 5, 3, 0, 0, 1870, - 1875, 3, 68, 34, 0, 1871, 1872, 5, 5, 0, 0, 1872, 1874, 3, 68, 34, 0, 1873, - 1871, 1, 0, 0, 0, 1874, 1877, 1, 0, 0, 0, 1875, 1873, 1, 0, 0, 0, 1875, - 1876, 1, 0, 0, 0, 1876, 1880, 1, 0, 0, 0, 1877, 1875, 1, 0, 0, 0, 1878, - 1880, 5, 7, 0, 0, 1879, 1870, 1, 0, 0, 0, 1879, 1878, 1, 0, 0, 0, 1879, - 1880, 1, 0, 0, 0, 1880, 1881, 1, 0, 0, 0, 1881, 1883, 5, 4, 0, 0, 1882, - 1884, 3, 116, 58, 0, 1883, 1882, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, - 1885, 1, 0, 0, 0, 1885, 1888, 5, 153, 0, 0, 1886, 1889, 3, 118, 59, 0, - 1887, 1889, 3, 214, 107, 0, 1888, 1886, 1, 0, 0, 0, 1888, 1887, 1, 0, 0, - 0, 1889, 131, 1, 0, 0, 0, 1890, 1892, 5, 150, 0, 0, 1891, 1893, 5, 116, - 0, 0, 1892, 1891, 1, 0, 0, 0, 1892, 1893, 1, 0, 0, 0, 1893, 1894, 1, 0, - 0, 0, 1894, 1899, 3, 56, 28, 0, 1895, 1896, 5, 5, 0, 0, 1896, 1898, 3, - 56, 28, 0, 1897, 1895, 1, 0, 0, 0, 1898, 1901, 1, 0, 0, 0, 1899, 1897, - 1, 0, 0, 0, 1899, 1900, 1, 0, 0, 0, 1900, 133, 1, 0, 0, 0, 1901, 1899, - 1, 0, 0, 0, 1902, 1903, 5, 109, 0, 0, 1903, 1904, 5, 40, 0, 0, 1904, 1909, - 3, 138, 69, 0, 1905, 1906, 5, 5, 0, 0, 1906, 1908, 3, 138, 69, 0, 1907, - 1905, 1, 0, 0, 0, 1908, 1911, 1, 0, 0, 0, 1909, 1907, 1, 0, 0, 0, 1909, - 1910, 1, 0, 0, 0, 1910, 135, 1, 0, 0, 0, 1911, 1909, 1, 0, 0, 0, 1912, - 1913, 5, 98, 0, 0, 1913, 1916, 3, 68, 34, 0, 1914, 1915, 7, 19, 0, 0, 1915, - 1917, 3, 68, 34, 0, 1916, 1914, 1, 0, 0, 0, 1916, 1917, 1, 0, 0, 0, 1917, - 137, 1, 0, 0, 0, 1918, 1921, 3, 68, 34, 0, 1919, 1920, 5, 45, 0, 0, 1920, - 1922, 3, 192, 96, 0, 1921, 1919, 1, 0, 0, 0, 1921, 1922, 1, 0, 0, 0, 1922, - 1924, 1, 0, 0, 0, 1923, 1925, 3, 140, 70, 0, 1924, 1923, 1, 0, 0, 0, 1924, - 1925, 1, 0, 0, 0, 1925, 1928, 1, 0, 0, 0, 1926, 1927, 5, 176, 0, 0, 1927, - 1929, 7, 20, 0, 0, 1928, 1926, 1, 0, 0, 0, 1928, 1929, 1, 0, 0, 0, 1929, - 139, 1, 0, 0, 0, 1930, 1931, 7, 21, 0, 0, 1931, 141, 1, 0, 0, 0, 1932, - 1933, 3, 68, 34, 0, 1933, 1934, 5, 156, 0, 0, 1934, 1943, 1, 0, 0, 0, 1935, - 1936, 3, 68, 34, 0, 1936, 1937, 5, 159, 0, 0, 1937, 1943, 1, 0, 0, 0, 1938, - 1939, 5, 158, 0, 0, 1939, 1943, 5, 127, 0, 0, 1940, 1941, 5, 157, 0, 0, - 1941, 1943, 5, 156, 0, 0, 1942, 1932, 1, 0, 0, 0, 1942, 1935, 1, 0, 0, - 0, 1942, 1938, 1, 0, 0, 0, 1942, 1940, 1, 0, 0, 0, 1943, 143, 1, 0, 0, - 0, 1944, 1945, 3, 68, 34, 0, 1945, 1946, 5, 156, 0, 0, 1946, 1955, 1, 0, - 0, 0, 1947, 1948, 3, 68, 34, 0, 1948, 1949, 5, 159, 0, 0, 1949, 1955, 1, - 0, 0, 0, 1950, 1951, 5, 158, 0, 0, 1951, 1955, 5, 127, 0, 0, 1952, 1953, - 5, 157, 0, 0, 1953, 1955, 5, 159, 0, 0, 1954, 1944, 1, 0, 0, 0, 1954, 1947, - 1, 0, 0, 0, 1954, 1950, 1, 0, 0, 0, 1954, 1952, 1, 0, 0, 0, 1955, 145, - 1, 0, 0, 0, 1956, 1957, 3, 68, 34, 0, 1957, 1958, 5, 156, 0, 0, 1958, 1964, - 1, 0, 0, 0, 1959, 1960, 5, 157, 0, 0, 1960, 1964, 5, 156, 0, 0, 1961, 1962, - 5, 158, 0, 0, 1962, 1964, 5, 127, 0, 0, 1963, 1956, 1, 0, 0, 0, 1963, 1959, - 1, 0, 0, 0, 1963, 1961, 1, 0, 0, 0, 1964, 147, 1, 0, 0, 0, 1965, 1966, - 7, 22, 0, 0, 1966, 1967, 5, 3, 0, 0, 1967, 1968, 3, 68, 34, 0, 1968, 1969, - 5, 4, 0, 0, 1969, 1970, 5, 153, 0, 0, 1970, 1972, 5, 3, 0, 0, 1971, 1973, - 3, 154, 77, 0, 1972, 1971, 1, 0, 0, 0, 1972, 1973, 1, 0, 0, 0, 1973, 1974, - 1, 0, 0, 0, 1974, 1976, 3, 158, 79, 0, 1975, 1977, 3, 124, 62, 0, 1976, - 1975, 1, 0, 0, 0, 1976, 1977, 1, 0, 0, 0, 1977, 1978, 1, 0, 0, 0, 1978, - 1979, 5, 4, 0, 0, 1979, 2051, 1, 0, 0, 0, 1980, 1981, 7, 23, 0, 0, 1981, - 1982, 5, 3, 0, 0, 1982, 1983, 5, 4, 0, 0, 1983, 1984, 5, 153, 0, 0, 1984, - 1986, 5, 3, 0, 0, 1985, 1987, 3, 154, 77, 0, 1986, 1985, 1, 0, 0, 0, 1986, - 1987, 1, 0, 0, 0, 1987, 1989, 1, 0, 0, 0, 1988, 1990, 3, 156, 78, 0, 1989, - 1988, 1, 0, 0, 0, 1989, 1990, 1, 0, 0, 0, 1990, 1991, 1, 0, 0, 0, 1991, - 2051, 5, 4, 0, 0, 1992, 1993, 7, 24, 0, 0, 1993, 1994, 5, 3, 0, 0, 1994, - 1995, 5, 4, 0, 0, 1995, 1996, 5, 153, 0, 0, 1996, 1998, 5, 3, 0, 0, 1997, - 1999, 3, 154, 77, 0, 1998, 1997, 1, 0, 0, 0, 1998, 1999, 1, 0, 0, 0, 1999, - 2000, 1, 0, 0, 0, 2000, 2001, 3, 158, 79, 0, 2001, 2002, 5, 4, 0, 0, 2002, - 2051, 1, 0, 0, 0, 2003, 2004, 7, 25, 0, 0, 2004, 2005, 5, 3, 0, 0, 2005, - 2007, 3, 68, 34, 0, 2006, 2008, 3, 150, 75, 0, 2007, 2006, 1, 0, 0, 0, - 2007, 2008, 1, 0, 0, 0, 2008, 2010, 1, 0, 0, 0, 2009, 2011, 3, 152, 76, - 0, 2010, 2009, 1, 0, 0, 0, 2010, 2011, 1, 0, 0, 0, 2011, 2012, 1, 0, 0, - 0, 2012, 2013, 5, 4, 0, 0, 2013, 2014, 5, 153, 0, 0, 2014, 2016, 5, 3, - 0, 0, 2015, 2017, 3, 154, 77, 0, 2016, 2015, 1, 0, 0, 0, 2016, 2017, 1, - 0, 0, 0, 2017, 2018, 1, 0, 0, 0, 2018, 2019, 3, 158, 79, 0, 2019, 2020, - 5, 4, 0, 0, 2020, 2051, 1, 0, 0, 0, 2021, 2022, 5, 165, 0, 0, 2022, 2023, - 5, 3, 0, 0, 2023, 2024, 3, 68, 34, 0, 2024, 2025, 5, 5, 0, 0, 2025, 2026, - 3, 36, 18, 0, 2026, 2027, 5, 4, 0, 0, 2027, 2028, 5, 153, 0, 0, 2028, 2030, - 5, 3, 0, 0, 2029, 2031, 3, 154, 77, 0, 2030, 2029, 1, 0, 0, 0, 2030, 2031, - 1, 0, 0, 0, 2031, 2032, 1, 0, 0, 0, 2032, 2034, 3, 158, 79, 0, 2033, 2035, - 3, 124, 62, 0, 2034, 2033, 1, 0, 0, 0, 2034, 2035, 1, 0, 0, 0, 2035, 2036, - 1, 0, 0, 0, 2036, 2037, 5, 4, 0, 0, 2037, 2051, 1, 0, 0, 0, 2038, 2039, - 5, 166, 0, 0, 2039, 2040, 5, 3, 0, 0, 2040, 2041, 3, 68, 34, 0, 2041, 2042, - 5, 4, 0, 0, 2042, 2043, 5, 153, 0, 0, 2043, 2045, 5, 3, 0, 0, 2044, 2046, - 3, 154, 77, 0, 2045, 2044, 1, 0, 0, 0, 2045, 2046, 1, 0, 0, 0, 2046, 2047, - 1, 0, 0, 0, 2047, 2048, 3, 158, 79, 0, 2048, 2049, 5, 4, 0, 0, 2049, 2051, - 1, 0, 0, 0, 2050, 1965, 1, 0, 0, 0, 2050, 1980, 1, 0, 0, 0, 2050, 1992, - 1, 0, 0, 0, 2050, 2003, 1, 0, 0, 0, 2050, 2021, 1, 0, 0, 0, 2050, 2038, - 1, 0, 0, 0, 2051, 149, 1, 0, 0, 0, 2052, 2053, 5, 5, 0, 0, 2053, 2054, - 3, 36, 18, 0, 2054, 151, 1, 0, 0, 0, 2055, 2056, 5, 5, 0, 0, 2056, 2057, - 3, 36, 18, 0, 2057, 153, 1, 0, 0, 0, 2058, 2059, 5, 154, 0, 0, 2059, 2061, - 5, 40, 0, 0, 2060, 2062, 3, 68, 34, 0, 2061, 2060, 1, 0, 0, 0, 2062, 2063, - 1, 0, 0, 0, 2063, 2061, 1, 0, 0, 0, 2063, 2064, 1, 0, 0, 0, 2064, 155, - 1, 0, 0, 0, 2065, 2066, 5, 109, 0, 0, 2066, 2068, 5, 40, 0, 0, 2067, 2069, - 3, 68, 34, 0, 2068, 2067, 1, 0, 0, 0, 2069, 2070, 1, 0, 0, 0, 2070, 2068, - 1, 0, 0, 0, 2070, 2071, 1, 0, 0, 0, 2071, 157, 1, 0, 0, 0, 2072, 2073, - 5, 109, 0, 0, 2073, 2074, 5, 40, 0, 0, 2074, 2075, 3, 158, 79, 0, 2075, - 159, 1, 0, 0, 0, 2076, 2078, 3, 68, 34, 0, 2077, 2079, 3, 140, 70, 0, 2078, - 2077, 1, 0, 0, 0, 2078, 2079, 1, 0, 0, 0, 2079, 2087, 1, 0, 0, 0, 2080, - 2081, 5, 5, 0, 0, 2081, 2083, 3, 68, 34, 0, 2082, 2084, 3, 140, 70, 0, - 2083, 2082, 1, 0, 0, 0, 2083, 2084, 1, 0, 0, 0, 2084, 2086, 1, 0, 0, 0, - 2085, 2080, 1, 0, 0, 0, 2086, 2089, 1, 0, 0, 0, 2087, 2085, 1, 0, 0, 0, - 2087, 2088, 1, 0, 0, 0, 2088, 161, 1, 0, 0, 0, 2089, 2087, 1, 0, 0, 0, - 2090, 2091, 3, 84, 42, 0, 2091, 163, 1, 0, 0, 0, 2092, 2093, 3, 84, 42, - 0, 2093, 165, 1, 0, 0, 0, 2094, 2095, 7, 26, 0, 0, 2095, 167, 1, 0, 0, - 0, 2096, 2097, 5, 190, 0, 0, 2097, 169, 1, 0, 0, 0, 2098, 2101, 3, 68, - 34, 0, 2099, 2101, 3, 30, 15, 0, 2100, 2098, 1, 0, 0, 0, 2100, 2099, 1, - 0, 0, 0, 2101, 171, 1, 0, 0, 0, 2102, 2103, 7, 27, 0, 0, 2103, 173, 1, - 0, 0, 0, 2104, 2105, 7, 28, 0, 0, 2105, 175, 1, 0, 0, 0, 2106, 2107, 3, - 228, 114, 0, 2107, 177, 1, 0, 0, 0, 2108, 2109, 3, 228, 114, 0, 2109, 179, - 1, 0, 0, 0, 2110, 2111, 3, 182, 91, 0, 2111, 2112, 5, 2, 0, 0, 2112, 2114, - 1, 0, 0, 0, 2113, 2110, 1, 0, 0, 0, 2113, 2114, 1, 0, 0, 0, 2114, 2115, - 1, 0, 0, 0, 2115, 2116, 3, 178, 89, 0, 2116, 181, 1, 0, 0, 0, 2117, 2118, - 3, 228, 114, 0, 2118, 183, 1, 0, 0, 0, 2119, 2120, 3, 228, 114, 0, 2120, - 185, 1, 0, 0, 0, 2121, 2122, 3, 228, 114, 0, 2122, 187, 1, 0, 0, 0, 2123, - 2124, 3, 228, 114, 0, 2124, 189, 1, 0, 0, 0, 2125, 2126, 3, 228, 114, 0, - 2126, 191, 1, 0, 0, 0, 2127, 2128, 3, 228, 114, 0, 2128, 193, 1, 0, 0, - 0, 2129, 2130, 3, 228, 114, 0, 2130, 195, 1, 0, 0, 0, 2131, 2132, 3, 228, - 114, 0, 2132, 197, 1, 0, 0, 0, 2133, 2134, 3, 228, 114, 0, 2134, 199, 1, - 0, 0, 0, 2135, 2136, 3, 228, 114, 0, 2136, 201, 1, 0, 0, 0, 2137, 2138, - 3, 228, 114, 0, 2138, 203, 1, 0, 0, 0, 2139, 2140, 3, 228, 114, 0, 2140, - 205, 1, 0, 0, 0, 2141, 2142, 3, 228, 114, 0, 2142, 207, 1, 0, 0, 0, 2143, - 2144, 7, 27, 0, 0, 2144, 209, 1, 0, 0, 0, 2145, 2146, 3, 228, 114, 0, 2146, - 211, 1, 0, 0, 0, 2147, 2148, 3, 228, 114, 0, 2148, 213, 1, 0, 0, 0, 2149, - 2150, 3, 228, 114, 0, 2150, 215, 1, 0, 0, 0, 2151, 2152, 3, 228, 114, 0, - 2152, 217, 1, 0, 0, 0, 2153, 2154, 3, 228, 114, 0, 2154, 219, 1, 0, 0, - 0, 2155, 2156, 3, 228, 114, 0, 2156, 221, 1, 0, 0, 0, 2157, 2158, 3, 228, - 114, 0, 2158, 223, 1, 0, 0, 0, 2159, 2160, 3, 228, 114, 0, 2160, 225, 1, - 0, 0, 0, 2161, 2162, 3, 228, 114, 0, 2162, 227, 1, 0, 0, 0, 2163, 2171, - 5, 186, 0, 0, 2164, 2171, 3, 174, 87, 0, 2165, 2171, 5, 190, 0, 0, 2166, - 2167, 5, 3, 0, 0, 2167, 2168, 3, 228, 114, 0, 2168, 2169, 5, 4, 0, 0, 2169, - 2171, 1, 0, 0, 0, 2170, 2163, 1, 0, 0, 0, 2170, 2164, 1, 0, 0, 0, 2170, - 2165, 1, 0, 0, 0, 2170, 2166, 1, 0, 0, 0, 2171, 229, 1, 0, 0, 0, 314, 233, + 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, 1204, + 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, 1205, + 1, 0, 0, 0, 1202, 1200, 1, 0, 0, 0, 1203, 1205, 3, 84, 42, 0, 1204, 1175, + 1, 0, 0, 0, 1204, 1203, 1, 0, 0, 0, 1205, 1207, 1, 0, 0, 0, 1206, 1208, + 3, 76, 38, 0, 1207, 1206, 1, 0, 0, 0, 1207, 1208, 1, 0, 0, 0, 1208, 1210, + 1, 0, 0, 0, 1209, 1211, 3, 58, 29, 0, 1210, 1209, 1, 0, 0, 0, 1210, 1211, + 1, 0, 0, 0, 1211, 1215, 1, 0, 0, 0, 1212, 1213, 5, 58, 0, 0, 1213, 1215, + 5, 147, 0, 0, 1214, 1142, 1, 0, 0, 0, 1214, 1212, 1, 0, 0, 0, 1215, 75, + 1, 0, 0, 0, 1216, 1217, 5, 109, 0, 0, 1217, 1232, 5, 50, 0, 0, 1218, 1219, + 5, 3, 0, 0, 1219, 1224, 3, 24, 12, 0, 1220, 1221, 5, 5, 0, 0, 1221, 1223, + 3, 24, 12, 0, 1222, 1220, 1, 0, 0, 0, 1223, 1226, 1, 0, 0, 0, 1224, 1222, + 1, 0, 0, 0, 1224, 1225, 1, 0, 0, 0, 1225, 1227, 1, 0, 0, 0, 1226, 1224, + 1, 0, 0, 0, 1227, 1230, 5, 4, 0, 0, 1228, 1229, 5, 151, 0, 0, 1229, 1231, + 3, 68, 34, 0, 1230, 1228, 1, 0, 0, 0, 1230, 1231, 1, 0, 0, 0, 1231, 1233, + 1, 0, 0, 0, 1232, 1218, 1, 0, 0, 0, 1232, 1233, 1, 0, 0, 0, 1233, 1234, + 1, 0, 0, 0, 1234, 1261, 5, 186, 0, 0, 1235, 1262, 5, 187, 0, 0, 1236, 1237, + 5, 144, 0, 0, 1237, 1240, 5, 133, 0, 0, 1238, 1241, 3, 190, 95, 0, 1239, + 1241, 3, 108, 54, 0, 1240, 1238, 1, 0, 0, 0, 1240, 1239, 1, 0, 0, 0, 1241, + 1242, 1, 0, 0, 0, 1242, 1243, 5, 6, 0, 0, 1243, 1254, 3, 68, 34, 0, 1244, + 1247, 5, 5, 0, 0, 1245, 1248, 3, 190, 95, 0, 1246, 1248, 3, 108, 54, 0, + 1247, 1245, 1, 0, 0, 0, 1247, 1246, 1, 0, 0, 0, 1248, 1249, 1, 0, 0, 0, + 1249, 1250, 5, 6, 0, 0, 1250, 1251, 3, 68, 34, 0, 1251, 1253, 1, 0, 0, + 0, 1252, 1244, 1, 0, 0, 0, 1253, 1256, 1, 0, 0, 0, 1254, 1252, 1, 0, 0, + 0, 1254, 1255, 1, 0, 0, 0, 1255, 1259, 1, 0, 0, 0, 1256, 1254, 1, 0, 0, + 0, 1257, 1258, 5, 151, 0, 0, 1258, 1260, 3, 68, 34, 0, 1259, 1257, 1, 0, + 0, 0, 1259, 1260, 1, 0, 0, 0, 1260, 1262, 1, 0, 0, 0, 1261, 1235, 1, 0, + 0, 0, 1261, 1236, 1, 0, 0, 0, 1262, 77, 1, 0, 0, 0, 1263, 1267, 5, 114, + 0, 0, 1264, 1265, 3, 182, 91, 0, 1265, 1266, 5, 2, 0, 0, 1266, 1268, 1, + 0, 0, 0, 1267, 1264, 1, 0, 0, 0, 1267, 1268, 1, 0, 0, 0, 1268, 1269, 1, + 0, 0, 0, 1269, 1276, 3, 204, 102, 0, 1270, 1271, 5, 6, 0, 0, 1271, 1277, + 3, 80, 40, 0, 1272, 1273, 5, 3, 0, 0, 1273, 1274, 3, 80, 40, 0, 1274, 1275, + 5, 4, 0, 0, 1275, 1277, 1, 0, 0, 0, 1276, 1270, 1, 0, 0, 0, 1276, 1272, + 1, 0, 0, 0, 1276, 1277, 1, 0, 0, 0, 1277, 79, 1, 0, 0, 0, 1278, 1282, 3, + 36, 18, 0, 1279, 1282, 3, 176, 88, 0, 1280, 1282, 5, 192, 0, 0, 1281, 1278, + 1, 0, 0, 0, 1281, 1279, 1, 0, 0, 0, 1281, 1280, 1, 0, 0, 0, 1282, 81, 1, + 0, 0, 0, 1283, 1294, 5, 121, 0, 0, 1284, 1295, 3, 192, 96, 0, 1285, 1286, + 3, 182, 91, 0, 1286, 1287, 5, 2, 0, 0, 1287, 1289, 1, 0, 0, 0, 1288, 1285, + 1, 0, 0, 0, 1288, 1289, 1, 0, 0, 0, 1289, 1292, 1, 0, 0, 0, 1290, 1293, + 3, 184, 92, 0, 1291, 1293, 3, 196, 98, 0, 1292, 1290, 1, 0, 0, 0, 1292, + 1291, 1, 0, 0, 0, 1293, 1295, 1, 0, 0, 0, 1294, 1284, 1, 0, 0, 0, 1294, + 1288, 1, 0, 0, 0, 1294, 1295, 1, 0, 0, 0, 1295, 83, 1, 0, 0, 0, 1296, 1298, + 3, 132, 66, 0, 1297, 1296, 1, 0, 0, 0, 1297, 1298, 1, 0, 0, 0, 1298, 1299, + 1, 0, 0, 0, 1299, 1305, 3, 88, 44, 0, 1300, 1301, 3, 104, 52, 0, 1301, + 1302, 3, 88, 44, 0, 1302, 1304, 1, 0, 0, 0, 1303, 1300, 1, 0, 0, 0, 1304, + 1307, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1305, 1306, 1, 0, 0, 0, 1306, + 1309, 1, 0, 0, 0, 1307, 1305, 1, 0, 0, 0, 1308, 1310, 3, 134, 67, 0, 1309, + 1308, 1, 0, 0, 0, 1309, 1310, 1, 0, 0, 0, 1310, 1312, 1, 0, 0, 0, 1311, + 1313, 3, 136, 68, 0, 1312, 1311, 1, 0, 0, 0, 1312, 1313, 1, 0, 0, 0, 1313, + 85, 1, 0, 0, 0, 1314, 1321, 3, 96, 48, 0, 1315, 1316, 3, 100, 50, 0, 1316, + 1317, 3, 96, 48, 0, 1317, 1318, 3, 102, 51, 0, 1318, 1320, 1, 0, 0, 0, + 1319, 1315, 1, 0, 0, 0, 1320, 1323, 1, 0, 0, 0, 1321, 1319, 1, 0, 0, 0, + 1321, 1322, 1, 0, 0, 0, 1322, 87, 1, 0, 0, 0, 1323, 1321, 1, 0, 0, 0, 1324, + 1326, 5, 132, 0, 0, 1325, 1327, 7, 17, 0, 0, 1326, 1325, 1, 0, 0, 0, 1326, + 1327, 1, 0, 0, 0, 1327, 1328, 1, 0, 0, 0, 1328, 1333, 3, 98, 49, 0, 1329, + 1330, 5, 5, 0, 0, 1330, 1332, 3, 98, 49, 0, 1331, 1329, 1, 0, 0, 0, 1332, + 1335, 1, 0, 0, 0, 1333, 1331, 1, 0, 0, 0, 1333, 1334, 1, 0, 0, 0, 1334, + 1348, 1, 0, 0, 0, 1335, 1333, 1, 0, 0, 0, 1336, 1346, 5, 77, 0, 0, 1337, + 1342, 3, 96, 48, 0, 1338, 1339, 5, 5, 0, 0, 1339, 1341, 3, 96, 48, 0, 1340, + 1338, 1, 0, 0, 0, 1341, 1344, 1, 0, 0, 0, 1342, 1340, 1, 0, 0, 0, 1342, + 1343, 1, 0, 0, 0, 1343, 1347, 1, 0, 0, 0, 1344, 1342, 1, 0, 0, 0, 1345, + 1347, 3, 86, 43, 0, 1346, 1337, 1, 0, 0, 0, 1346, 1345, 1, 0, 0, 0, 1347, + 1349, 1, 0, 0, 0, 1348, 1336, 1, 0, 0, 0, 1348, 1349, 1, 0, 0, 0, 1349, + 1352, 1, 0, 0, 0, 1350, 1351, 5, 151, 0, 0, 1351, 1353, 3, 68, 34, 0, 1352, + 1350, 1, 0, 0, 0, 1352, 1353, 1, 0, 0, 0, 1353, 1368, 1, 0, 0, 0, 1354, + 1355, 5, 80, 0, 0, 1355, 1356, 5, 42, 0, 0, 1356, 1361, 3, 68, 34, 0, 1357, + 1358, 5, 5, 0, 0, 1358, 1360, 3, 68, 34, 0, 1359, 1357, 1, 0, 0, 0, 1360, + 1363, 1, 0, 0, 0, 1361, 1359, 1, 0, 0, 0, 1361, 1362, 1, 0, 0, 0, 1362, + 1366, 1, 0, 0, 0, 1363, 1361, 1, 0, 0, 0, 1364, 1365, 5, 81, 0, 0, 1365, + 1367, 3, 68, 34, 0, 1366, 1364, 1, 0, 0, 0, 1366, 1367, 1, 0, 0, 0, 1367, + 1369, 1, 0, 0, 0, 1368, 1354, 1, 0, 0, 0, 1368, 1369, 1, 0, 0, 0, 1369, + 1384, 1, 0, 0, 0, 1370, 1371, 5, 177, 0, 0, 1371, 1372, 3, 214, 107, 0, + 1372, 1373, 5, 35, 0, 0, 1373, 1381, 3, 118, 59, 0, 1374, 1375, 5, 5, 0, + 0, 1375, 1376, 3, 214, 107, 0, 1376, 1377, 5, 35, 0, 0, 1377, 1378, 3, + 118, 59, 0, 1378, 1380, 1, 0, 0, 0, 1379, 1374, 1, 0, 0, 0, 1380, 1383, + 1, 0, 0, 0, 1381, 1379, 1, 0, 0, 0, 1381, 1382, 1, 0, 0, 0, 1382, 1385, + 1, 0, 0, 0, 1383, 1381, 1, 0, 0, 0, 1384, 1370, 1, 0, 0, 0, 1384, 1385, + 1, 0, 0, 0, 1385, 1415, 1, 0, 0, 0, 1386, 1387, 5, 147, 0, 0, 1387, 1388, + 5, 3, 0, 0, 1388, 1393, 3, 68, 34, 0, 1389, 1390, 5, 5, 0, 0, 1390, 1392, + 3, 68, 34, 0, 1391, 1389, 1, 0, 0, 0, 1392, 1395, 1, 0, 0, 0, 1393, 1391, + 1, 0, 0, 0, 1393, 1394, 1, 0, 0, 0, 1394, 1396, 1, 0, 0, 0, 1395, 1393, + 1, 0, 0, 0, 1396, 1411, 5, 4, 0, 0, 1397, 1398, 5, 5, 0, 0, 1398, 1399, + 5, 3, 0, 0, 1399, 1404, 3, 68, 34, 0, 1400, 1401, 5, 5, 0, 0, 1401, 1403, + 3, 68, 34, 0, 1402, 1400, 1, 0, 0, 0, 1403, 1406, 1, 0, 0, 0, 1404, 1402, + 1, 0, 0, 0, 1404, 1405, 1, 0, 0, 0, 1405, 1407, 1, 0, 0, 0, 1406, 1404, + 1, 0, 0, 0, 1407, 1408, 5, 4, 0, 0, 1408, 1410, 1, 0, 0, 0, 1409, 1397, + 1, 0, 0, 0, 1410, 1413, 1, 0, 0, 0, 1411, 1409, 1, 0, 0, 0, 1411, 1412, + 1, 0, 0, 0, 1412, 1415, 1, 0, 0, 0, 1413, 1411, 1, 0, 0, 0, 1414, 1324, + 1, 0, 0, 0, 1414, 1386, 1, 0, 0, 0, 1415, 89, 1, 0, 0, 0, 1416, 1417, 3, + 84, 42, 0, 1417, 91, 1, 0, 0, 0, 1418, 1420, 3, 132, 66, 0, 1419, 1418, + 1, 0, 0, 0, 1419, 1420, 1, 0, 0, 0, 1420, 1421, 1, 0, 0, 0, 1421, 1423, + 3, 88, 44, 0, 1422, 1424, 3, 134, 67, 0, 1423, 1422, 1, 0, 0, 0, 1423, + 1424, 1, 0, 0, 0, 1424, 1426, 1, 0, 0, 0, 1425, 1427, 3, 136, 68, 0, 1426, + 1425, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 93, 1, 0, 0, 0, 1428, 1430, + 3, 132, 66, 0, 1429, 1428, 1, 0, 0, 0, 1429, 1430, 1, 0, 0, 0, 1430, 1431, + 1, 0, 0, 0, 1431, 1441, 3, 88, 44, 0, 1432, 1434, 5, 142, 0, 0, 1433, 1435, + 5, 31, 0, 0, 1434, 1433, 1, 0, 0, 0, 1434, 1435, 1, 0, 0, 0, 1435, 1439, + 1, 0, 0, 0, 1436, 1439, 5, 92, 0, 0, 1437, 1439, 5, 70, 0, 0, 1438, 1432, + 1, 0, 0, 0, 1438, 1436, 1, 0, 0, 0, 1438, 1437, 1, 0, 0, 0, 1439, 1440, + 1, 0, 0, 0, 1440, 1442, 3, 88, 44, 0, 1441, 1438, 1, 0, 0, 0, 1442, 1443, + 1, 0, 0, 0, 1443, 1441, 1, 0, 0, 0, 1443, 1444, 1, 0, 0, 0, 1444, 1446, + 1, 0, 0, 0, 1445, 1447, 3, 134, 67, 0, 1446, 1445, 1, 0, 0, 0, 1446, 1447, + 1, 0, 0, 0, 1447, 1449, 1, 0, 0, 0, 1448, 1450, 3, 136, 68, 0, 1449, 1448, + 1, 0, 0, 0, 1449, 1450, 1, 0, 0, 0, 1450, 95, 1, 0, 0, 0, 1451, 1452, 3, + 182, 91, 0, 1452, 1453, 5, 2, 0, 0, 1453, 1455, 1, 0, 0, 0, 1454, 1451, + 1, 0, 0, 0, 1454, 1455, 1, 0, 0, 0, 1455, 1456, 1, 0, 0, 0, 1456, 1461, + 3, 184, 92, 0, 1457, 1459, 5, 35, 0, 0, 1458, 1457, 1, 0, 0, 0, 1458, 1459, + 1, 0, 0, 0, 1459, 1460, 1, 0, 0, 0, 1460, 1462, 3, 208, 104, 0, 1461, 1458, + 1, 0, 0, 0, 1461, 1462, 1, 0, 0, 0, 1462, 1468, 1, 0, 0, 0, 1463, 1464, + 5, 87, 0, 0, 1464, 1465, 5, 42, 0, 0, 1465, 1469, 3, 196, 98, 0, 1466, + 1467, 5, 104, 0, 0, 1467, 1469, 5, 87, 0, 0, 1468, 1463, 1, 0, 0, 0, 1468, + 1466, 1, 0, 0, 0, 1468, 1469, 1, 0, 0, 0, 1469, 1580, 1, 0, 0, 0, 1470, + 1471, 3, 182, 91, 0, 1471, 1472, 5, 2, 0, 0, 1472, 1474, 1, 0, 0, 0, 1473, + 1470, 1, 0, 0, 0, 1473, 1474, 1, 0, 0, 0, 1474, 1475, 1, 0, 0, 0, 1475, + 1476, 3, 226, 113, 0, 1476, 1477, 5, 3, 0, 0, 1477, 1482, 3, 68, 34, 0, + 1478, 1479, 5, 5, 0, 0, 1479, 1481, 3, 68, 34, 0, 1480, 1478, 1, 0, 0, + 0, 1481, 1484, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1482, 1483, 1, 0, 0, + 0, 1483, 1485, 1, 0, 0, 0, 1484, 1482, 1, 0, 0, 0, 1485, 1490, 5, 4, 0, + 0, 1486, 1488, 5, 35, 0, 0, 1487, 1486, 1, 0, 0, 0, 1487, 1488, 1, 0, 0, + 0, 1488, 1489, 1, 0, 0, 0, 1489, 1491, 3, 208, 104, 0, 1490, 1487, 1, 0, + 0, 0, 1490, 1491, 1, 0, 0, 0, 1491, 1580, 1, 0, 0, 0, 1492, 1502, 5, 3, + 0, 0, 1493, 1498, 3, 96, 48, 0, 1494, 1495, 5, 5, 0, 0, 1495, 1497, 3, + 96, 48, 0, 1496, 1494, 1, 0, 0, 0, 1497, 1500, 1, 0, 0, 0, 1498, 1496, + 1, 0, 0, 0, 1498, 1499, 1, 0, 0, 0, 1499, 1503, 1, 0, 0, 0, 1500, 1498, + 1, 0, 0, 0, 1501, 1503, 3, 86, 43, 0, 1502, 1493, 1, 0, 0, 0, 1502, 1501, + 1, 0, 0, 0, 1503, 1504, 1, 0, 0, 0, 1504, 1505, 5, 4, 0, 0, 1505, 1580, + 1, 0, 0, 0, 1506, 1507, 5, 3, 0, 0, 1507, 1508, 3, 84, 42, 0, 1508, 1513, + 5, 4, 0, 0, 1509, 1511, 5, 35, 0, 0, 1510, 1509, 1, 0, 0, 0, 1510, 1511, + 1, 0, 0, 0, 1511, 1512, 1, 0, 0, 0, 1512, 1514, 3, 208, 104, 0, 1513, 1510, + 1, 0, 0, 0, 1513, 1514, 1, 0, 0, 0, 1514, 1580, 1, 0, 0, 0, 1515, 1516, + 3, 182, 91, 0, 1516, 1517, 5, 2, 0, 0, 1517, 1519, 1, 0, 0, 0, 1518, 1515, + 1, 0, 0, 0, 1518, 1519, 1, 0, 0, 0, 1519, 1520, 1, 0, 0, 0, 1520, 1525, + 3, 184, 92, 0, 1521, 1523, 5, 35, 0, 0, 1522, 1521, 1, 0, 0, 0, 1522, 1523, + 1, 0, 0, 0, 1523, 1524, 1, 0, 0, 0, 1524, 1526, 3, 210, 105, 0, 1525, 1522, + 1, 0, 0, 0, 1525, 1526, 1, 0, 0, 0, 1526, 1532, 1, 0, 0, 0, 1527, 1528, + 5, 87, 0, 0, 1528, 1529, 5, 42, 0, 0, 1529, 1533, 3, 196, 98, 0, 1530, + 1531, 5, 104, 0, 0, 1531, 1533, 5, 87, 0, 0, 1532, 1527, 1, 0, 0, 0, 1532, + 1530, 1, 0, 0, 0, 1532, 1533, 1, 0, 0, 0, 1533, 1580, 1, 0, 0, 0, 1534, + 1535, 3, 182, 91, 0, 1535, 1536, 5, 2, 0, 0, 1536, 1538, 1, 0, 0, 0, 1537, + 1534, 1, 0, 0, 0, 1537, 1538, 1, 0, 0, 0, 1538, 1539, 1, 0, 0, 0, 1539, + 1540, 3, 226, 113, 0, 1540, 1541, 5, 3, 0, 0, 1541, 1546, 3, 68, 34, 0, + 1542, 1543, 5, 5, 0, 0, 1543, 1545, 3, 68, 34, 0, 1544, 1542, 1, 0, 0, + 0, 1545, 1548, 1, 0, 0, 0, 1546, 1544, 1, 0, 0, 0, 1546, 1547, 1, 0, 0, + 0, 1547, 1549, 1, 0, 0, 0, 1548, 1546, 1, 0, 0, 0, 1549, 1554, 5, 4, 0, + 0, 1550, 1552, 5, 35, 0, 0, 1551, 1550, 1, 0, 0, 0, 1551, 1552, 1, 0, 0, + 0, 1552, 1553, 1, 0, 0, 0, 1553, 1555, 3, 210, 105, 0, 1554, 1551, 1, 0, + 0, 0, 1554, 1555, 1, 0, 0, 0, 1555, 1580, 1, 0, 0, 0, 1556, 1566, 5, 3, + 0, 0, 1557, 1562, 3, 96, 48, 0, 1558, 1559, 5, 5, 0, 0, 1559, 1561, 3, + 96, 48, 0, 1560, 1558, 1, 0, 0, 0, 1561, 1564, 1, 0, 0, 0, 1562, 1560, + 1, 0, 0, 0, 1562, 1563, 1, 0, 0, 0, 1563, 1567, 1, 0, 0, 0, 1564, 1562, + 1, 0, 0, 0, 1565, 1567, 3, 86, 43, 0, 1566, 1557, 1, 0, 0, 0, 1566, 1565, + 1, 0, 0, 0, 1567, 1568, 1, 0, 0, 0, 1568, 1569, 5, 4, 0, 0, 1569, 1580, + 1, 0, 0, 0, 1570, 1571, 5, 3, 0, 0, 1571, 1572, 3, 84, 42, 0, 1572, 1577, + 5, 4, 0, 0, 1573, 1575, 5, 35, 0, 0, 1574, 1573, 1, 0, 0, 0, 1574, 1575, + 1, 0, 0, 0, 1575, 1576, 1, 0, 0, 0, 1576, 1578, 3, 210, 105, 0, 1577, 1574, + 1, 0, 0, 0, 1577, 1578, 1, 0, 0, 0, 1578, 1580, 1, 0, 0, 0, 1579, 1454, + 1, 0, 0, 0, 1579, 1473, 1, 0, 0, 0, 1579, 1492, 1, 0, 0, 0, 1579, 1506, + 1, 0, 0, 0, 1579, 1518, 1, 0, 0, 0, 1579, 1537, 1, 0, 0, 0, 1579, 1556, + 1, 0, 0, 0, 1579, 1570, 1, 0, 0, 0, 1580, 97, 1, 0, 0, 0, 1581, 1594, 5, + 7, 0, 0, 1582, 1583, 3, 184, 92, 0, 1583, 1584, 5, 2, 0, 0, 1584, 1585, + 5, 7, 0, 0, 1585, 1594, 1, 0, 0, 0, 1586, 1591, 3, 68, 34, 0, 1587, 1589, + 5, 35, 0, 0, 1588, 1587, 1, 0, 0, 0, 1588, 1589, 1, 0, 0, 0, 1589, 1590, + 1, 0, 0, 0, 1590, 1592, 3, 172, 86, 0, 1591, 1588, 1, 0, 0, 0, 1591, 1592, + 1, 0, 0, 0, 1592, 1594, 1, 0, 0, 0, 1593, 1581, 1, 0, 0, 0, 1593, 1582, + 1, 0, 0, 0, 1593, 1586, 1, 0, 0, 0, 1594, 99, 1, 0, 0, 0, 1595, 1610, 5, + 5, 0, 0, 1596, 1598, 5, 102, 0, 0, 1597, 1596, 1, 0, 0, 0, 1597, 1598, + 1, 0, 0, 0, 1598, 1604, 1, 0, 0, 0, 1599, 1601, 7, 18, 0, 0, 1600, 1602, + 5, 112, 0, 0, 1601, 1600, 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1605, + 1, 0, 0, 0, 1603, 1605, 5, 89, 0, 0, 1604, 1599, 1, 0, 0, 0, 1604, 1603, + 1, 0, 0, 0, 1604, 1605, 1, 0, 0, 0, 1605, 1606, 1, 0, 0, 0, 1606, 1610, + 5, 96, 0, 0, 1607, 1608, 5, 53, 0, 0, 1608, 1610, 5, 96, 0, 0, 1609, 1595, + 1, 0, 0, 0, 1609, 1597, 1, 0, 0, 0, 1609, 1607, 1, 0, 0, 0, 1610, 101, + 1, 0, 0, 0, 1611, 1612, 5, 109, 0, 0, 1612, 1626, 3, 68, 34, 0, 1613, 1614, + 5, 145, 0, 0, 1614, 1615, 5, 3, 0, 0, 1615, 1620, 3, 190, 95, 0, 1616, + 1617, 5, 5, 0, 0, 1617, 1619, 3, 190, 95, 0, 1618, 1616, 1, 0, 0, 0, 1619, + 1622, 1, 0, 0, 0, 1620, 1618, 1, 0, 0, 0, 1620, 1621, 1, 0, 0, 0, 1621, + 1623, 1, 0, 0, 0, 1622, 1620, 1, 0, 0, 0, 1623, 1624, 5, 4, 0, 0, 1624, + 1626, 1, 0, 0, 0, 1625, 1611, 1, 0, 0, 0, 1625, 1613, 1, 0, 0, 0, 1625, + 1626, 1, 0, 0, 0, 1626, 103, 1, 0, 0, 0, 1627, 1629, 5, 142, 0, 0, 1628, + 1630, 5, 31, 0, 0, 1629, 1628, 1, 0, 0, 0, 1629, 1630, 1, 0, 0, 0, 1630, + 1634, 1, 0, 0, 0, 1631, 1634, 5, 92, 0, 0, 1632, 1634, 5, 70, 0, 0, 1633, + 1627, 1, 0, 0, 0, 1633, 1631, 1, 0, 0, 0, 1633, 1632, 1, 0, 0, 0, 1634, + 105, 1, 0, 0, 0, 1635, 1637, 3, 50, 25, 0, 1636, 1635, 1, 0, 0, 0, 1636, + 1637, 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1641, 5, 144, 0, 0, 1639, + 1640, 5, 110, 0, 0, 1640, 1642, 7, 8, 0, 0, 1641, 1639, 1, 0, 0, 0, 1641, + 1642, 1, 0, 0, 0, 1642, 1643, 1, 0, 0, 0, 1643, 1644, 3, 112, 56, 0, 1644, + 1647, 5, 133, 0, 0, 1645, 1648, 3, 190, 95, 0, 1646, 1648, 3, 108, 54, + 0, 1647, 1645, 1, 0, 0, 0, 1647, 1646, 1, 0, 0, 0, 1648, 1649, 1, 0, 0, + 0, 1649, 1650, 5, 6, 0, 0, 1650, 1661, 3, 68, 34, 0, 1651, 1654, 5, 5, + 0, 0, 1652, 1655, 3, 190, 95, 0, 1653, 1655, 3, 108, 54, 0, 1654, 1652, + 1, 0, 0, 0, 1654, 1653, 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1657, + 5, 6, 0, 0, 1657, 1658, 3, 68, 34, 0, 1658, 1660, 1, 0, 0, 0, 1659, 1651, + 1, 0, 0, 0, 1660, 1663, 1, 0, 0, 0, 1661, 1659, 1, 0, 0, 0, 1661, 1662, + 1, 0, 0, 0, 1662, 1666, 1, 0, 0, 0, 1663, 1661, 1, 0, 0, 0, 1664, 1665, + 5, 151, 0, 0, 1665, 1667, 3, 68, 34, 0, 1666, 1664, 1, 0, 0, 0, 1666, 1667, + 1, 0, 0, 0, 1667, 1669, 1, 0, 0, 0, 1668, 1670, 3, 58, 29, 0, 1669, 1668, + 1, 0, 0, 0, 1669, 1670, 1, 0, 0, 0, 1670, 107, 1, 0, 0, 0, 1671, 1672, + 5, 3, 0, 0, 1672, 1677, 3, 190, 95, 0, 1673, 1674, 5, 5, 0, 0, 1674, 1676, + 3, 190, 95, 0, 1675, 1673, 1, 0, 0, 0, 1676, 1679, 1, 0, 0, 0, 1677, 1675, + 1, 0, 0, 0, 1677, 1678, 1, 0, 0, 0, 1678, 1680, 1, 0, 0, 0, 1679, 1677, + 1, 0, 0, 0, 1680, 1681, 5, 4, 0, 0, 1681, 109, 1, 0, 0, 0, 1682, 1684, + 3, 50, 25, 0, 1683, 1682, 1, 0, 0, 0, 1683, 1684, 1, 0, 0, 0, 1684, 1685, + 1, 0, 0, 0, 1685, 1688, 5, 144, 0, 0, 1686, 1687, 5, 110, 0, 0, 1687, 1689, + 7, 8, 0, 0, 1688, 1686, 1, 0, 0, 0, 1688, 1689, 1, 0, 0, 0, 1689, 1690, + 1, 0, 0, 0, 1690, 1691, 3, 112, 56, 0, 1691, 1694, 5, 133, 0, 0, 1692, + 1695, 3, 190, 95, 0, 1693, 1695, 3, 108, 54, 0, 1694, 1692, 1, 0, 0, 0, + 1694, 1693, 1, 0, 0, 0, 1695, 1696, 1, 0, 0, 0, 1696, 1697, 5, 6, 0, 0, + 1697, 1708, 3, 68, 34, 0, 1698, 1701, 5, 5, 0, 0, 1699, 1702, 3, 190, 95, + 0, 1700, 1702, 3, 108, 54, 0, 1701, 1699, 1, 0, 0, 0, 1701, 1700, 1, 0, + 0, 0, 1702, 1703, 1, 0, 0, 0, 1703, 1704, 5, 6, 0, 0, 1704, 1705, 3, 68, + 34, 0, 1705, 1707, 1, 0, 0, 0, 1706, 1698, 1, 0, 0, 0, 1707, 1710, 1, 0, + 0, 0, 1708, 1706, 1, 0, 0, 0, 1708, 1709, 1, 0, 0, 0, 1709, 1713, 1, 0, + 0, 0, 1710, 1708, 1, 0, 0, 0, 1711, 1712, 5, 151, 0, 0, 1712, 1714, 3, + 68, 34, 0, 1713, 1711, 1, 0, 0, 0, 1713, 1714, 1, 0, 0, 0, 1714, 1719, + 1, 0, 0, 0, 1715, 1717, 3, 134, 67, 0, 1716, 1715, 1, 0, 0, 0, 1716, 1717, + 1, 0, 0, 0, 1717, 1718, 1, 0, 0, 0, 1718, 1720, 3, 136, 68, 0, 1719, 1716, + 1, 0, 0, 0, 1719, 1720, 1, 0, 0, 0, 1720, 111, 1, 0, 0, 0, 1721, 1722, + 3, 182, 91, 0, 1722, 1723, 5, 2, 0, 0, 1723, 1725, 1, 0, 0, 0, 1724, 1721, + 1, 0, 0, 0, 1724, 1725, 1, 0, 0, 0, 1725, 1726, 1, 0, 0, 0, 1726, 1729, + 3, 184, 92, 0, 1727, 1728, 5, 35, 0, 0, 1728, 1730, 3, 216, 108, 0, 1729, + 1727, 1, 0, 0, 0, 1729, 1730, 1, 0, 0, 0, 1730, 1736, 1, 0, 0, 0, 1731, + 1732, 5, 87, 0, 0, 1732, 1733, 5, 42, 0, 0, 1733, 1737, 3, 196, 98, 0, + 1734, 1735, 5, 104, 0, 0, 1735, 1737, 5, 87, 0, 0, 1736, 1731, 1, 0, 0, + 0, 1736, 1734, 1, 0, 0, 0, 1736, 1737, 1, 0, 0, 0, 1737, 113, 1, 0, 0, + 0, 1738, 1740, 5, 146, 0, 0, 1739, 1741, 3, 182, 91, 0, 1740, 1739, 1, + 0, 0, 0, 1740, 1741, 1, 0, 0, 0, 1741, 1744, 1, 0, 0, 0, 1742, 1743, 5, + 93, 0, 0, 1743, 1745, 3, 218, 109, 0, 1744, 1742, 1, 0, 0, 0, 1744, 1745, + 1, 0, 0, 0, 1745, 115, 1, 0, 0, 0, 1746, 1747, 5, 181, 0, 0, 1747, 1748, + 5, 3, 0, 0, 1748, 1749, 5, 151, 0, 0, 1749, 1750, 3, 68, 34, 0, 1750, 1751, + 5, 4, 0, 0, 1751, 117, 1, 0, 0, 0, 1752, 1754, 5, 3, 0, 0, 1753, 1755, + 3, 220, 110, 0, 1754, 1753, 1, 0, 0, 0, 1754, 1755, 1, 0, 0, 0, 1755, 1766, + 1, 0, 0, 0, 1756, 1757, 5, 156, 0, 0, 1757, 1758, 5, 42, 0, 0, 1758, 1763, + 3, 68, 34, 0, 1759, 1760, 5, 5, 0, 0, 1760, 1762, 3, 68, 34, 0, 1761, 1759, + 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1763, 1764, + 1, 0, 0, 0, 1764, 1767, 1, 0, 0, 0, 1765, 1763, 1, 0, 0, 0, 1766, 1756, + 1, 0, 0, 0, 1766, 1767, 1, 0, 0, 0, 1767, 1768, 1, 0, 0, 0, 1768, 1769, + 5, 111, 0, 0, 1769, 1770, 5, 42, 0, 0, 1770, 1775, 3, 138, 69, 0, 1771, + 1772, 5, 5, 0, 0, 1772, 1774, 3, 138, 69, 0, 1773, 1771, 1, 0, 0, 0, 1774, + 1777, 1, 0, 0, 0, 1775, 1773, 1, 0, 0, 0, 1775, 1776, 1, 0, 0, 0, 1776, + 1779, 1, 0, 0, 0, 1777, 1775, 1, 0, 0, 0, 1778, 1780, 3, 122, 61, 0, 1779, + 1778, 1, 0, 0, 0, 1779, 1780, 1, 0, 0, 0, 1780, 1781, 1, 0, 0, 0, 1781, + 1782, 5, 4, 0, 0, 1782, 119, 1, 0, 0, 0, 1783, 1817, 5, 155, 0, 0, 1784, + 1818, 3, 214, 107, 0, 1785, 1787, 5, 3, 0, 0, 1786, 1788, 3, 220, 110, + 0, 1787, 1786, 1, 0, 0, 0, 1787, 1788, 1, 0, 0, 0, 1788, 1799, 1, 0, 0, + 0, 1789, 1790, 5, 156, 0, 0, 1790, 1791, 5, 42, 0, 0, 1791, 1796, 3, 68, + 34, 0, 1792, 1793, 5, 5, 0, 0, 1793, 1795, 3, 68, 34, 0, 1794, 1792, 1, + 0, 0, 0, 1795, 1798, 1, 0, 0, 0, 1796, 1794, 1, 0, 0, 0, 1796, 1797, 1, + 0, 0, 0, 1797, 1800, 1, 0, 0, 0, 1798, 1796, 1, 0, 0, 0, 1799, 1789, 1, + 0, 0, 0, 1799, 1800, 1, 0, 0, 0, 1800, 1811, 1, 0, 0, 0, 1801, 1802, 5, + 111, 0, 0, 1802, 1803, 5, 42, 0, 0, 1803, 1808, 3, 138, 69, 0, 1804, 1805, + 5, 5, 0, 0, 1805, 1807, 3, 138, 69, 0, 1806, 1804, 1, 0, 0, 0, 1807, 1810, + 1, 0, 0, 0, 1808, 1806, 1, 0, 0, 0, 1808, 1809, 1, 0, 0, 0, 1809, 1812, + 1, 0, 0, 0, 1810, 1808, 1, 0, 0, 0, 1811, 1801, 1, 0, 0, 0, 1811, 1812, + 1, 0, 0, 0, 1812, 1814, 1, 0, 0, 0, 1813, 1815, 3, 122, 61, 0, 1814, 1813, + 1, 0, 0, 0, 1814, 1815, 1, 0, 0, 0, 1815, 1816, 1, 0, 0, 0, 1816, 1818, + 5, 4, 0, 0, 1817, 1784, 1, 0, 0, 0, 1817, 1785, 1, 0, 0, 0, 1818, 121, + 1, 0, 0, 0, 1819, 1827, 3, 124, 62, 0, 1820, 1821, 5, 183, 0, 0, 1821, + 1822, 5, 103, 0, 0, 1822, 1828, 5, 185, 0, 0, 1823, 1824, 5, 160, 0, 0, + 1824, 1828, 5, 129, 0, 0, 1825, 1828, 5, 80, 0, 0, 1826, 1828, 5, 184, + 0, 0, 1827, 1820, 1, 0, 0, 0, 1827, 1823, 1, 0, 0, 0, 1827, 1825, 1, 0, + 0, 0, 1827, 1826, 1, 0, 0, 0, 1827, 1828, 1, 0, 0, 0, 1828, 123, 1, 0, + 0, 0, 1829, 1836, 7, 19, 0, 0, 1830, 1837, 3, 146, 73, 0, 1831, 1832, 5, + 41, 0, 0, 1832, 1833, 3, 142, 71, 0, 1833, 1834, 5, 34, 0, 0, 1834, 1835, + 3, 144, 72, 0, 1835, 1837, 1, 0, 0, 0, 1836, 1830, 1, 0, 0, 0, 1836, 1831, + 1, 0, 0, 0, 1837, 125, 1, 0, 0, 0, 1838, 1839, 3, 222, 111, 0, 1839, 1849, + 5, 3, 0, 0, 1840, 1845, 3, 68, 34, 0, 1841, 1842, 5, 5, 0, 0, 1842, 1844, + 3, 68, 34, 0, 1843, 1841, 1, 0, 0, 0, 1844, 1847, 1, 0, 0, 0, 1845, 1843, + 1, 0, 0, 0, 1845, 1846, 1, 0, 0, 0, 1846, 1850, 1, 0, 0, 0, 1847, 1845, + 1, 0, 0, 0, 1848, 1850, 5, 7, 0, 0, 1849, 1840, 1, 0, 0, 0, 1849, 1848, + 1, 0, 0, 0, 1850, 1851, 1, 0, 0, 0, 1851, 1852, 5, 4, 0, 0, 1852, 127, + 1, 0, 0, 0, 1853, 1854, 3, 224, 112, 0, 1854, 1867, 5, 3, 0, 0, 1855, 1857, + 5, 64, 0, 0, 1856, 1855, 1, 0, 0, 0, 1856, 1857, 1, 0, 0, 0, 1857, 1858, + 1, 0, 0, 0, 1858, 1863, 3, 68, 34, 0, 1859, 1860, 5, 5, 0, 0, 1860, 1862, + 3, 68, 34, 0, 1861, 1859, 1, 0, 0, 0, 1862, 1865, 1, 0, 0, 0, 1863, 1861, + 1, 0, 0, 0, 1863, 1864, 1, 0, 0, 0, 1864, 1868, 1, 0, 0, 0, 1865, 1863, + 1, 0, 0, 0, 1866, 1868, 5, 7, 0, 0, 1867, 1856, 1, 0, 0, 0, 1867, 1866, + 1, 0, 0, 0, 1867, 1868, 1, 0, 0, 0, 1868, 1869, 1, 0, 0, 0, 1869, 1871, + 5, 4, 0, 0, 1870, 1872, 3, 116, 58, 0, 1871, 1870, 1, 0, 0, 0, 1871, 1872, + 1, 0, 0, 0, 1872, 129, 1, 0, 0, 0, 1873, 1874, 3, 148, 74, 0, 1874, 1884, + 5, 3, 0, 0, 1875, 1880, 3, 68, 34, 0, 1876, 1877, 5, 5, 0, 0, 1877, 1879, + 3, 68, 34, 0, 1878, 1876, 1, 0, 0, 0, 1879, 1882, 1, 0, 0, 0, 1880, 1878, + 1, 0, 0, 0, 1880, 1881, 1, 0, 0, 0, 1881, 1885, 1, 0, 0, 0, 1882, 1880, + 1, 0, 0, 0, 1883, 1885, 5, 7, 0, 0, 1884, 1875, 1, 0, 0, 0, 1884, 1883, + 1, 0, 0, 0, 1884, 1885, 1, 0, 0, 0, 1885, 1886, 1, 0, 0, 0, 1886, 1888, + 5, 4, 0, 0, 1887, 1889, 3, 116, 58, 0, 1888, 1887, 1, 0, 0, 0, 1888, 1889, + 1, 0, 0, 0, 1889, 1890, 1, 0, 0, 0, 1890, 1893, 5, 155, 0, 0, 1891, 1894, + 3, 118, 59, 0, 1892, 1894, 3, 214, 107, 0, 1893, 1891, 1, 0, 0, 0, 1893, + 1892, 1, 0, 0, 0, 1894, 131, 1, 0, 0, 0, 1895, 1897, 5, 152, 0, 0, 1896, + 1898, 5, 118, 0, 0, 1897, 1896, 1, 0, 0, 0, 1897, 1898, 1, 0, 0, 0, 1898, + 1899, 1, 0, 0, 0, 1899, 1904, 3, 56, 28, 0, 1900, 1901, 5, 5, 0, 0, 1901, + 1903, 3, 56, 28, 0, 1902, 1900, 1, 0, 0, 0, 1903, 1906, 1, 0, 0, 0, 1904, + 1902, 1, 0, 0, 0, 1904, 1905, 1, 0, 0, 0, 1905, 133, 1, 0, 0, 0, 1906, + 1904, 1, 0, 0, 0, 1907, 1908, 5, 111, 0, 0, 1908, 1909, 5, 42, 0, 0, 1909, + 1914, 3, 138, 69, 0, 1910, 1911, 5, 5, 0, 0, 1911, 1913, 3, 138, 69, 0, + 1912, 1910, 1, 0, 0, 0, 1913, 1916, 1, 0, 0, 0, 1914, 1912, 1, 0, 0, 0, + 1914, 1915, 1, 0, 0, 0, 1915, 135, 1, 0, 0, 0, 1916, 1914, 1, 0, 0, 0, + 1917, 1918, 5, 100, 0, 0, 1918, 1921, 3, 68, 34, 0, 1919, 1920, 7, 20, + 0, 0, 1920, 1922, 3, 68, 34, 0, 1921, 1919, 1, 0, 0, 0, 1921, 1922, 1, + 0, 0, 0, 1922, 137, 1, 0, 0, 0, 1923, 1926, 3, 68, 34, 0, 1924, 1925, 5, + 47, 0, 0, 1925, 1927, 3, 192, 96, 0, 1926, 1924, 1, 0, 0, 0, 1926, 1927, + 1, 0, 0, 0, 1927, 1929, 1, 0, 0, 0, 1928, 1930, 3, 140, 70, 0, 1929, 1928, + 1, 0, 0, 0, 1929, 1930, 1, 0, 0, 0, 1930, 1933, 1, 0, 0, 0, 1931, 1932, + 5, 178, 0, 0, 1932, 1934, 7, 21, 0, 0, 1933, 1931, 1, 0, 0, 0, 1933, 1934, + 1, 0, 0, 0, 1934, 139, 1, 0, 0, 0, 1935, 1936, 7, 22, 0, 0, 1936, 141, + 1, 0, 0, 0, 1937, 1938, 3, 68, 34, 0, 1938, 1939, 5, 158, 0, 0, 1939, 1948, + 1, 0, 0, 0, 1940, 1941, 3, 68, 34, 0, 1941, 1942, 5, 161, 0, 0, 1942, 1948, + 1, 0, 0, 0, 1943, 1944, 5, 160, 0, 0, 1944, 1948, 5, 129, 0, 0, 1945, 1946, + 5, 159, 0, 0, 1946, 1948, 5, 158, 0, 0, 1947, 1937, 1, 0, 0, 0, 1947, 1940, + 1, 0, 0, 0, 1947, 1943, 1, 0, 0, 0, 1947, 1945, 1, 0, 0, 0, 1948, 143, + 1, 0, 0, 0, 1949, 1950, 3, 68, 34, 0, 1950, 1951, 5, 158, 0, 0, 1951, 1960, + 1, 0, 0, 0, 1952, 1953, 3, 68, 34, 0, 1953, 1954, 5, 161, 0, 0, 1954, 1960, + 1, 0, 0, 0, 1955, 1956, 5, 160, 0, 0, 1956, 1960, 5, 129, 0, 0, 1957, 1958, + 5, 159, 0, 0, 1958, 1960, 5, 161, 0, 0, 1959, 1949, 1, 0, 0, 0, 1959, 1952, + 1, 0, 0, 0, 1959, 1955, 1, 0, 0, 0, 1959, 1957, 1, 0, 0, 0, 1960, 145, + 1, 0, 0, 0, 1961, 1962, 3, 68, 34, 0, 1962, 1963, 5, 158, 0, 0, 1963, 1969, + 1, 0, 0, 0, 1964, 1965, 5, 159, 0, 0, 1965, 1969, 5, 158, 0, 0, 1966, 1967, + 5, 160, 0, 0, 1967, 1969, 5, 129, 0, 0, 1968, 1961, 1, 0, 0, 0, 1968, 1964, + 1, 0, 0, 0, 1968, 1966, 1, 0, 0, 0, 1969, 147, 1, 0, 0, 0, 1970, 1971, + 7, 23, 0, 0, 1971, 1972, 5, 3, 0, 0, 1972, 1973, 3, 68, 34, 0, 1973, 1974, + 5, 4, 0, 0, 1974, 1975, 5, 155, 0, 0, 1975, 1977, 5, 3, 0, 0, 1976, 1978, + 3, 154, 77, 0, 1977, 1976, 1, 0, 0, 0, 1977, 1978, 1, 0, 0, 0, 1978, 1979, + 1, 0, 0, 0, 1979, 1981, 3, 158, 79, 0, 1980, 1982, 3, 124, 62, 0, 1981, + 1980, 1, 0, 0, 0, 1981, 1982, 1, 0, 0, 0, 1982, 1983, 1, 0, 0, 0, 1983, + 1984, 5, 4, 0, 0, 1984, 2056, 1, 0, 0, 0, 1985, 1986, 7, 24, 0, 0, 1986, + 1987, 5, 3, 0, 0, 1987, 1988, 5, 4, 0, 0, 1988, 1989, 5, 155, 0, 0, 1989, + 1991, 5, 3, 0, 0, 1990, 1992, 3, 154, 77, 0, 1991, 1990, 1, 0, 0, 0, 1991, + 1992, 1, 0, 0, 0, 1992, 1994, 1, 0, 0, 0, 1993, 1995, 3, 156, 78, 0, 1994, + 1993, 1, 0, 0, 0, 1994, 1995, 1, 0, 0, 0, 1995, 1996, 1, 0, 0, 0, 1996, + 2056, 5, 4, 0, 0, 1997, 1998, 7, 25, 0, 0, 1998, 1999, 5, 3, 0, 0, 1999, + 2000, 5, 4, 0, 0, 2000, 2001, 5, 155, 0, 0, 2001, 2003, 5, 3, 0, 0, 2002, + 2004, 3, 154, 77, 0, 2003, 2002, 1, 0, 0, 0, 2003, 2004, 1, 0, 0, 0, 2004, + 2005, 1, 0, 0, 0, 2005, 2006, 3, 158, 79, 0, 2006, 2007, 5, 4, 0, 0, 2007, + 2056, 1, 0, 0, 0, 2008, 2009, 7, 26, 0, 0, 2009, 2010, 5, 3, 0, 0, 2010, + 2012, 3, 68, 34, 0, 2011, 2013, 3, 150, 75, 0, 2012, 2011, 1, 0, 0, 0, + 2012, 2013, 1, 0, 0, 0, 2013, 2015, 1, 0, 0, 0, 2014, 2016, 3, 152, 76, + 0, 2015, 2014, 1, 0, 0, 0, 2015, 2016, 1, 0, 0, 0, 2016, 2017, 1, 0, 0, + 0, 2017, 2018, 5, 4, 0, 0, 2018, 2019, 5, 155, 0, 0, 2019, 2021, 5, 3, + 0, 0, 2020, 2022, 3, 154, 77, 0, 2021, 2020, 1, 0, 0, 0, 2021, 2022, 1, + 0, 0, 0, 2022, 2023, 1, 0, 0, 0, 2023, 2024, 3, 158, 79, 0, 2024, 2025, + 5, 4, 0, 0, 2025, 2056, 1, 0, 0, 0, 2026, 2027, 5, 167, 0, 0, 2027, 2028, + 5, 3, 0, 0, 2028, 2029, 3, 68, 34, 0, 2029, 2030, 5, 5, 0, 0, 2030, 2031, + 3, 36, 18, 0, 2031, 2032, 5, 4, 0, 0, 2032, 2033, 5, 155, 0, 0, 2033, 2035, + 5, 3, 0, 0, 2034, 2036, 3, 154, 77, 0, 2035, 2034, 1, 0, 0, 0, 2035, 2036, + 1, 0, 0, 0, 2036, 2037, 1, 0, 0, 0, 2037, 2039, 3, 158, 79, 0, 2038, 2040, + 3, 124, 62, 0, 2039, 2038, 1, 0, 0, 0, 2039, 2040, 1, 0, 0, 0, 2040, 2041, + 1, 0, 0, 0, 2041, 2042, 5, 4, 0, 0, 2042, 2056, 1, 0, 0, 0, 2043, 2044, + 5, 168, 0, 0, 2044, 2045, 5, 3, 0, 0, 2045, 2046, 3, 68, 34, 0, 2046, 2047, + 5, 4, 0, 0, 2047, 2048, 5, 155, 0, 0, 2048, 2050, 5, 3, 0, 0, 2049, 2051, + 3, 154, 77, 0, 2050, 2049, 1, 0, 0, 0, 2050, 2051, 1, 0, 0, 0, 2051, 2052, + 1, 0, 0, 0, 2052, 2053, 3, 158, 79, 0, 2053, 2054, 5, 4, 0, 0, 2054, 2056, + 1, 0, 0, 0, 2055, 1970, 1, 0, 0, 0, 2055, 1985, 1, 0, 0, 0, 2055, 1997, + 1, 0, 0, 0, 2055, 2008, 1, 0, 0, 0, 2055, 2026, 1, 0, 0, 0, 2055, 2043, + 1, 0, 0, 0, 2056, 149, 1, 0, 0, 0, 2057, 2058, 5, 5, 0, 0, 2058, 2059, + 3, 36, 18, 0, 2059, 151, 1, 0, 0, 0, 2060, 2061, 5, 5, 0, 0, 2061, 2062, + 3, 36, 18, 0, 2062, 153, 1, 0, 0, 0, 2063, 2064, 5, 156, 0, 0, 2064, 2066, + 5, 42, 0, 0, 2065, 2067, 3, 68, 34, 0, 2066, 2065, 1, 0, 0, 0, 2067, 2068, + 1, 0, 0, 0, 2068, 2066, 1, 0, 0, 0, 2068, 2069, 1, 0, 0, 0, 2069, 155, + 1, 0, 0, 0, 2070, 2071, 5, 111, 0, 0, 2071, 2073, 5, 42, 0, 0, 2072, 2074, + 3, 68, 34, 0, 2073, 2072, 1, 0, 0, 0, 2074, 2075, 1, 0, 0, 0, 2075, 2073, + 1, 0, 0, 0, 2075, 2076, 1, 0, 0, 0, 2076, 157, 1, 0, 0, 0, 2077, 2078, + 5, 111, 0, 0, 2078, 2079, 5, 42, 0, 0, 2079, 2080, 3, 158, 79, 0, 2080, + 159, 1, 0, 0, 0, 2081, 2083, 3, 68, 34, 0, 2082, 2084, 3, 140, 70, 0, 2083, + 2082, 1, 0, 0, 0, 2083, 2084, 1, 0, 0, 0, 2084, 2092, 1, 0, 0, 0, 2085, + 2086, 5, 5, 0, 0, 2086, 2088, 3, 68, 34, 0, 2087, 2089, 3, 140, 70, 0, + 2088, 2087, 1, 0, 0, 0, 2088, 2089, 1, 0, 0, 0, 2089, 2091, 1, 0, 0, 0, + 2090, 2085, 1, 0, 0, 0, 2091, 2094, 1, 0, 0, 0, 2092, 2090, 1, 0, 0, 0, + 2092, 2093, 1, 0, 0, 0, 2093, 161, 1, 0, 0, 0, 2094, 2092, 1, 0, 0, 0, + 2095, 2096, 3, 84, 42, 0, 2096, 163, 1, 0, 0, 0, 2097, 2098, 3, 84, 42, + 0, 2098, 165, 1, 0, 0, 0, 2099, 2100, 7, 27, 0, 0, 2100, 167, 1, 0, 0, + 0, 2101, 2102, 5, 192, 0, 0, 2102, 169, 1, 0, 0, 0, 2103, 2106, 3, 68, + 34, 0, 2104, 2106, 3, 30, 15, 0, 2105, 2103, 1, 0, 0, 0, 2105, 2104, 1, + 0, 0, 0, 2106, 171, 1, 0, 0, 0, 2107, 2108, 7, 28, 0, 0, 2108, 173, 1, + 0, 0, 0, 2109, 2110, 7, 29, 0, 0, 2110, 175, 1, 0, 0, 0, 2111, 2112, 3, + 228, 114, 0, 2112, 177, 1, 0, 0, 0, 2113, 2114, 3, 228, 114, 0, 2114, 179, + 1, 0, 0, 0, 2115, 2116, 3, 182, 91, 0, 2116, 2117, 5, 2, 0, 0, 2117, 2119, + 1, 0, 0, 0, 2118, 2115, 1, 0, 0, 0, 2118, 2119, 1, 0, 0, 0, 2119, 2120, + 1, 0, 0, 0, 2120, 2121, 3, 178, 89, 0, 2121, 181, 1, 0, 0, 0, 2122, 2123, + 3, 228, 114, 0, 2123, 183, 1, 0, 0, 0, 2124, 2125, 3, 228, 114, 0, 2125, + 185, 1, 0, 0, 0, 2126, 2127, 3, 228, 114, 0, 2127, 187, 1, 0, 0, 0, 2128, + 2129, 3, 228, 114, 0, 2129, 189, 1, 0, 0, 0, 2130, 2131, 3, 228, 114, 0, + 2131, 191, 1, 0, 0, 0, 2132, 2133, 3, 228, 114, 0, 2133, 193, 1, 0, 0, + 0, 2134, 2135, 3, 228, 114, 0, 2135, 195, 1, 0, 0, 0, 2136, 2137, 3, 228, + 114, 0, 2137, 197, 1, 0, 0, 0, 2138, 2139, 3, 228, 114, 0, 2139, 199, 1, + 0, 0, 0, 2140, 2141, 3, 228, 114, 0, 2141, 201, 1, 0, 0, 0, 2142, 2143, + 3, 228, 114, 0, 2143, 203, 1, 0, 0, 0, 2144, 2145, 3, 228, 114, 0, 2145, + 205, 1, 0, 0, 0, 2146, 2147, 3, 228, 114, 0, 2147, 207, 1, 0, 0, 0, 2148, + 2149, 7, 28, 0, 0, 2149, 209, 1, 0, 0, 0, 2150, 2151, 3, 228, 114, 0, 2151, + 211, 1, 0, 0, 0, 2152, 2153, 3, 228, 114, 0, 2153, 213, 1, 0, 0, 0, 2154, + 2155, 3, 228, 114, 0, 2155, 215, 1, 0, 0, 0, 2156, 2157, 3, 228, 114, 0, + 2157, 217, 1, 0, 0, 0, 2158, 2159, 3, 228, 114, 0, 2159, 219, 1, 0, 0, + 0, 2160, 2161, 3, 228, 114, 0, 2161, 221, 1, 0, 0, 0, 2162, 2163, 3, 228, + 114, 0, 2163, 223, 1, 0, 0, 0, 2164, 2165, 3, 228, 114, 0, 2165, 225, 1, + 0, 0, 0, 2166, 2167, 3, 228, 114, 0, 2167, 227, 1, 0, 0, 0, 2168, 2176, + 5, 188, 0, 0, 2169, 2176, 3, 174, 87, 0, 2170, 2176, 5, 192, 0, 0, 2171, + 2172, 5, 3, 0, 0, 2172, 2173, 3, 228, 114, 0, 2173, 2174, 5, 4, 0, 0, 2174, + 2176, 1, 0, 0, 0, 2175, 2168, 1, 0, 0, 0, 2175, 2169, 1, 0, 0, 0, 2175, + 2170, 1, 0, 0, 0, 2175, 2171, 1, 0, 0, 0, 2176, 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, @@ -1175,22 +1178,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, 1035, 1046, 1055, 1065, - 1068, 1074, 1080, 1089, 1092, 1096, 1103, 1109, 1116, 1118, 1120, 1129, - 1136, 1143, 1149, 1154, 1162, 1167, 1176, 1187, 1194, 1198, 1201, 1204, - 1208, 1218, 1224, 1226, 1234, 1241, 1248, 1253, 1255, 1261, 1270, 1275, - 1282, 1286, 1288, 1291, 1299, 1303, 1306, 1312, 1316, 1321, 1328, 1337, - 1341, 1343, 1347, 1356, 1361, 1363, 1376, 1379, 1388, 1399, 1406, 1409, - 1414, 1418, 1421, 1424, 1429, 1433, 1438, 1441, 1444, 1449, 1453, 1456, - 1463, 1468, 1477, 1482, 1485, 1493, 1497, 1505, 1508, 1513, 1517, 1520, - 1527, 1532, 1541, 1546, 1549, 1557, 1561, 1569, 1572, 1574, 1583, 1586, - 1588, 1592, 1596, 1599, 1604, 1615, 1620, 1624, 1628, 1631, 1636, 1642, - 1649, 1656, 1661, 1664, 1672, 1678, 1683, 1689, 1696, 1703, 1708, 1711, - 1714, 1719, 1724, 1731, 1735, 1739, 1749, 1758, 1761, 1770, 1774, 1782, - 1791, 1794, 1803, 1806, 1809, 1812, 1822, 1831, 1840, 1844, 1851, 1858, - 1862, 1866, 1875, 1879, 1883, 1888, 1892, 1899, 1909, 1916, 1921, 1924, - 1928, 1942, 1954, 1963, 1972, 1976, 1986, 1989, 1998, 2007, 2010, 2016, - 2030, 2034, 2045, 2050, 2063, 2070, 2078, 2083, 2087, 2100, 2113, 2170, + 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, 1204, 1207, + 1210, 1214, 1224, 1230, 1232, 1240, 1247, 1254, 1259, 1261, 1267, 1276, + 1281, 1288, 1292, 1294, 1297, 1305, 1309, 1312, 1321, 1326, 1333, 1342, + 1346, 1348, 1352, 1361, 1366, 1368, 1381, 1384, 1393, 1404, 1411, 1414, + 1419, 1423, 1426, 1429, 1434, 1438, 1443, 1446, 1449, 1454, 1458, 1461, + 1468, 1473, 1482, 1487, 1490, 1498, 1502, 1510, 1513, 1518, 1522, 1525, + 1532, 1537, 1546, 1551, 1554, 1562, 1566, 1574, 1577, 1579, 1588, 1591, + 1593, 1597, 1601, 1604, 1609, 1620, 1625, 1629, 1633, 1636, 1641, 1647, + 1654, 1661, 1666, 1669, 1677, 1683, 1688, 1694, 1701, 1708, 1713, 1716, + 1719, 1724, 1729, 1736, 1740, 1744, 1754, 1763, 1766, 1775, 1779, 1787, + 1796, 1799, 1808, 1811, 1814, 1817, 1827, 1836, 1845, 1849, 1856, 1863, + 1867, 1871, 1880, 1884, 1888, 1893, 1897, 1904, 1914, 1921, 1926, 1929, + 1933, 1947, 1959, 1968, 1977, 1981, 1991, 1994, 2003, 2012, 2015, 2021, + 2035, 2039, 2050, 2055, 2068, 2075, 2083, 2088, 2092, 2105, 2118, 2175, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -1207,7 +1210,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) } @@ -1216,11 +1219,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 @@ -1237,193 +1240,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. @@ -1562,23 +1567,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 @@ -1654,35 +1664,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)&-6624230852073095166) != 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() @@ -1690,14 +1684,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. @@ -1718,23 +1729,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 @@ -1814,44 +1830,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) } { @@ -1860,22 +1867,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) } { @@ -1886,26 +1908,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. @@ -1949,23 +2002,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 @@ -2392,51 +2450,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 + } } } @@ -2444,7 +2501,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) @@ -2589,9 +2650,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. @@ -2634,7 +2707,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 @@ -2642,17 +2715,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 @@ -2828,41 +2906,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() @@ -2870,8 +2936,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) @@ -2879,20 +2951,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) @@ -2903,12 +2990,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) @@ -2920,6 +3013,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) @@ -2929,22 +3026,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) @@ -2955,16 +3064,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) @@ -2972,10 +3091,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. @@ -2996,23 +3126,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 @@ -3083,47 +3218,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() @@ -3131,17 +3252,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. @@ -3163,23 +3302,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 @@ -3254,42 +3398,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) @@ -3298,13 +3432,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. @@ -3327,23 +3475,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 @@ -3410,44 +3563,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) @@ -3458,27 +3599,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. @@ -3498,23 +3658,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 @@ -3557,29 +3722,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) @@ -3594,17 +3740,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. @@ -3626,23 +3789,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 @@ -3705,63 +3873,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) @@ -3770,7 +3943,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. @@ -3789,23 +3972,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 @@ -3856,39 +4044,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. @@ -3908,23 +4090,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 @@ -3979,49 +4166,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. @@ -4057,23 +4244,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 @@ -4261,71 +4453,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() @@ -4333,8 +4535,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) @@ -4343,6 +4551,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) @@ -4351,6 +4563,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) @@ -4358,12 +4574,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) @@ -4372,20 +4595,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) @@ -4394,7 +4631,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. @@ -4416,23 +4663,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 @@ -4531,33 +4783,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) @@ -4570,15 +4807,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) @@ -4588,6 +4834,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_ { @@ -4598,7 +4847,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. @@ -4624,24 +4883,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 @@ -4688,30 +4952,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_: @@ -4719,6 +4966,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) @@ -4726,6 +4977,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_: @@ -4733,13 +4988,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. @@ -4778,23 +5048,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 @@ -5048,38 +5323,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_ { @@ -5099,29 +5362,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() @@ -5129,8 +5410,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) @@ -5138,12 +5425,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) @@ -5151,13 +5445,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) @@ -5167,16 +5470,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) @@ -5185,14 +5501,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_ { @@ -5202,12 +5528,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) @@ -5216,6 +5549,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) } @@ -5225,6 +5561,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) @@ -5232,10 +5572,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. @@ -5256,23 +5607,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 @@ -5376,28 +5732,8 @@ 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 p.EnterOuterAlt(localctx, 1) @@ -5408,17 +5744,24 @@ 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()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 43, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { @@ -5429,10 +5772,26 @@ func (p *SQLiteParser) Column_def() (localctx IColumn_defContext) { } p.SetState(483) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 43, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 43, 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 } // IType_nameContext is an interface to support dynamic dispatch. @@ -5456,23 +5815,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 @@ -5597,33 +5961,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 { @@ -5634,20 +5981,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) @@ -5656,12 +6011,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) @@ -5670,6 +6035,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) @@ -5678,11 +6047,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. @@ -5724,23 +6109,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 @@ -5967,38 +6357,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) @@ -6008,19 +6386,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_ { @@ -6032,6 +6424,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_ { @@ -6043,12 +6438,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 + } } } @@ -6056,29 +6458,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_ { @@ -6093,10 +6514,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) @@ -6105,16 +6534,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) @@ -6131,6 +6572,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) @@ -6139,14 +6584,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) @@ -6162,26 +6617,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) @@ -6190,9 +6664,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_ { @@ -6211,10 +6692,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. @@ -6234,23 +6726,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 @@ -6293,32 +6790,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 { @@ -6338,9 +6819,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. @@ -6375,23 +6870,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 @@ -6608,38 +7108,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) @@ -6649,35 +7137,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) @@ -6685,12 +7196,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) @@ -6699,14 +7217,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_ { @@ -6721,10 +7249,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) @@ -6733,20 +7269,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) @@ -6754,12 +7306,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) @@ -6768,11 +7327,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) @@ -6780,10 +7346,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. @@ -6837,23 +7414,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 @@ -7110,33 +7692,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) @@ -7144,12 +7711,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) @@ -7157,12 +7731,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) @@ -7171,27 +7752,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) @@ -7206,12 +7804,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) @@ -7229,32 +7834,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) @@ -7262,40 +7888,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) @@ -7311,9 +7959,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. @@ -7337,23 +7997,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 @@ -7412,43 +8077,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) @@ -7456,7 +8110,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. @@ -7514,23 +8178,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 @@ -7938,36 +8607,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_ { @@ -7987,29 +8644,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() @@ -8017,8 +8692,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) @@ -8026,28 +8707,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_: @@ -8056,33 +8755,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) @@ -8090,12 +8811,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) @@ -8104,17 +8832,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) @@ -8122,31 +8858,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) @@ -8157,15 +8915,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 == SQLiteParserDEFAULT_ || _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) @@ -8190,22 +8959,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. @@ -8240,23 +9032,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 @@ -8428,36 +9225,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_ { @@ -8477,29 +9262,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() @@ -8507,8 +9310,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) @@ -8516,12 +9325,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) @@ -8529,12 +9345,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) @@ -8543,24 +9366,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. @@ -8594,23 +9438,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 @@ -8778,64 +9627,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() @@ -8843,8 +9699,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) @@ -8853,6 +9715,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) @@ -8860,12 +9726,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) @@ -8873,12 +9746,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) @@ -8887,16 +9767,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. @@ -8927,23 +9824,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 @@ -9096,43 +9998,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) @@ -9141,10 +10034,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) @@ -9153,15 +10054,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) @@ -9170,10 +10082,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) @@ -9182,14 +10102,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. @@ -9213,23 +10150,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 @@ -9333,29 +10275,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) @@ -9363,12 +10286,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) @@ -9376,12 +10306,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) @@ -9390,16 +10327,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. @@ -9424,23 +10378,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 @@ -9539,29 +10498,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) @@ -9570,10 +10510,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) @@ -9582,15 +10530,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 + } } } @@ -9601,9 +10560,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. @@ -9631,23 +10604,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 @@ -9779,29 +10757,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) @@ -9809,12 +10768,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) @@ -9822,12 +10788,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) @@ -9836,21 +10809,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) @@ -9859,9 +10847,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. @@ -9889,23 +10891,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 @@ -10046,43 +11053,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: @@ -10092,17 +11091,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 + } } } @@ -10114,25 +11123,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: @@ -10142,17 +11166,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 + } } } @@ -10164,15 +11198,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. @@ -10196,23 +11244,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 @@ -10319,32 +11372,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_ { @@ -10357,10 +11394,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) @@ -10368,12 +11413,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) @@ -10383,6 +11435,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_ { @@ -10393,7 +11448,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. @@ -10419,23 +11484,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 @@ -10574,32 +11644,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_ { @@ -10612,10 +11666,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) @@ -10623,12 +11685,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) @@ -10638,11 +11707,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_ { @@ -10660,6 +11735,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_ { @@ -10670,7 +11748,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. @@ -10690,23 +11778,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 @@ -10761,49 +11854,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. @@ -10836,24 +11929,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 @@ -10952,33 +12050,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) @@ -10989,7 +12072,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 @@ -11001,21 +12084,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() @@ -11023,15 +12116,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. @@ -11045,23 +12154,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 @@ -11071,8 +12185,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 { @@ -11084,15 +12198,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 } @@ -11183,15 +12297,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 } @@ -11229,15 +12343,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 } @@ -11372,15 +12486,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 } @@ -11522,16 +12636,95 @@ func (s *Expr_comparisonContext) ExitRule(listener antlr.ParseTreeListener) { } } +type Expr_boolContext struct { + ExprContext +} + +func NewExpr_boolContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_boolContext { + var p = new(Expr_boolContext) + + InitEmptyExprContext(&p.ExprContext) + p.parser = parser + p.CopyAll(ctx.(*ExprContext)) + + return p +} + +func (s *Expr_boolContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_boolContext) 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_boolContext) 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_boolContext) AND_() antlr.TerminalNode { + return s.GetToken(SQLiteParserAND_, 0) +} + +func (s *Expr_boolContext) OR_() antlr.TerminalNode { + return s.GetToken(SQLiteParserOR_, 0) +} + +func (s *Expr_boolContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(SQLiteParserListener); ok { + listenerT.EnterExpr_bool(s) + } +} + +func (s *Expr_boolContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(SQLiteParserListener); ok { + listenerT.ExitExpr_bool(s) + } +} + type Expr_binaryContext struct { - *ExprContext + ExprContext } 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 } @@ -11585,12 +12778,32 @@ func (s *Expr_binaryContext) PIPE2() antlr.TerminalNode { return s.GetToken(SQLiteParserPIPE2, 0) } -func (s *Expr_binaryContext) AND_() antlr.TerminalNode { - return s.GetToken(SQLiteParserAND_, 0) +func (s *Expr_binaryContext) PTR() antlr.TerminalNode { + return s.GetToken(SQLiteParserPTR, 0) } -func (s *Expr_binaryContext) OR_() antlr.TerminalNode { - return s.GetToken(SQLiteParserOR_, 0) +func (s *Expr_binaryContext) PTR2() antlr.TerminalNode { + return s.GetToken(SQLiteParserPTR2, 0) +} + +func (s *Expr_binaryContext) STAR() antlr.TerminalNode { + return s.GetToken(SQLiteParserSTAR, 0) +} + +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) { @@ -11606,15 +12819,15 @@ func (s *Expr_binaryContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_literalContext struct { - *ExprContext + ExprContext } func NewExpr_literalContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_literalContext { var p = new(Expr_literalContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11652,15 +12865,15 @@ func (s *Expr_literalContext) ExitRule(listener antlr.ParseTreeListener) { } type Expr_castContext struct { - *ExprContext + ExprContext } func NewExpr_castContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_castContext { var p = new(Expr_castContext) - p.ExprContext = NewEmptyExprContext() + InitEmptyExprContext(&p.ExprContext) p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -11730,15 +12943,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 } @@ -11897,15 +13110,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 } @@ -11984,15 +13197,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 } @@ -12067,15 +13280,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 } @@ -12133,15 +13346,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 } @@ -12218,107 +13431,16 @@ func (s *Expr_qualified_column_nameContext) ExitRule(listener antlr.ParseTreeLis } } -type Expr_math_opContext struct { - *ExprContext +type Expr_unaryContext struct { + ExprContext } -func NewExpr_math_opContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_math_opContext { - var p = new(Expr_math_opContext) +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)) - - 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 -} - -func NewExpr_unaryContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Expr_unaryContext { - var p = new(Expr_unaryContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) + p.CopyAll(ctx.(*ExprContext)) return p } @@ -12372,15 +13494,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 } @@ -12434,15 +13556,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 } @@ -12476,10 +13598,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 @@ -12488,28 +13608,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) @@ -12527,6 +13635,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: @@ -12536,6 +13648,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: @@ -12545,11 +13661,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() @@ -12557,8 +13673,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) @@ -12567,8 +13689,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) @@ -12585,7 +13713,7 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(932) - p.expr(20) + p.expr(21) } case 6: @@ -12599,21 +13727,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) @@ -12621,12 +13761,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) @@ -12635,6 +13782,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) } @@ -12642,6 +13792,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: @@ -12651,26 +13805,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: @@ -12680,6 +13842,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) @@ -12687,12 +13853,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) @@ -12701,11 +13874,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: @@ -12715,10 +13895,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) @@ -12727,6 +13915,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) @@ -12735,6 +13927,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: @@ -12743,29 +13939,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) @@ -12774,6 +13988,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: @@ -12783,25 +14001,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) @@ -12810,6 +14041,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) @@ -12818,16 +14053,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) @@ -12838,6 +14083,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: @@ -12849,51 +14098,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(1120) + p.SetState(1126) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 144, 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(1118) + p.SetState(1124) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 143, 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) @@ -12902,22 +14168,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) @@ -12926,22 +14193,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) @@ -12950,7 +14218,7 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(1018) - p.expr(17) + p.expr(18) } case 5: @@ -12958,14 +14226,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) @@ -12974,7 +14243,7 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } { p.SetState(1021) - p.expr(16) + p.expr(17) } case 6: @@ -12982,348 +14251,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(1035) + p.SetState(1041) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 130, 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(1034) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == SQLiteParserNOT_ { + { + p.SetState(1033) + p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } { - p.SetState(1030) + p.SetState(1036) p.Match(SQLiteParserIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 8: { - p.SetState(1031) + p.SetState(1037) p.Match(SQLiteParserLIKE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 9: { - p.SetState(1032) + p.SetState(1038) p.Match(SQLiteParserGLOB_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 10: { - p.SetState(1033) + p.SetState(1039) p.Match(SQLiteParserMATCH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 11: { - p.SetState(1034) + p.SetState(1040) p.Match(SQLiteParserREGEXP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1037) + 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(1038) + 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(1039) + p.SetState(1045) p.Match(SQLiteParserAND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1040) + 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(1041) + 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(1042) + p.SetState(1048) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1043) + 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(1044) + 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(1046) + p.SetState(1052) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1045) + p.SetState(1051) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1048) + p.SetState(1054) p.Match(SQLiteParserBETWEEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1049) + p.SetState(1055) p.expr(0) } { - p.SetState(1050) + p.SetState(1056) p.Match(SQLiteParserAND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1051) + 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(1053) + 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(1055) + p.SetState(1061) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1054) + p.SetState(1060) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1057) + p.SetState(1063) p.Match(SQLiteParserIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1096) + p.SetState(1102) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 139, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 140, p.GetParserRuleContext()) { case 1: { - p.SetState(1058) + p.SetState(1064) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1068) + p.SetState(1074) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 134, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 135, p.GetParserRuleContext()) == 1 { { - p.SetState(1059) + p.SetState(1065) p.Select_stmt() } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 134, 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(1060) + p.SetState(1066) p.expr(0) } - p.SetState(1065) + p.SetState(1071) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1061) + p.SetState(1067) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1062) + p.SetState(1068) p.expr(0) } - p.SetState(1067) + 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(1070) + p.SetState(1076) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: - p.SetState(1074) + p.SetState(1080) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 135, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 136, p.GetParserRuleContext()) == 1 { { - p.SetState(1071) + p.SetState(1077) p.Schema_name() } { - p.SetState(1072) + p.SetState(1078) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1076) + p.SetState(1082) p.Table_name() } case 3: - p.SetState(1080) + p.SetState(1086) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 136, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 137, p.GetParserRuleContext()) == 1 { { - p.SetState(1077) + p.SetState(1083) p.Schema_name() } { - p.SetState(1078) + p.SetState(1084) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1082) + p.SetState(1088) p.Table_function_name() } { - p.SetState(1083) + p.SetState(1089) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1092) + 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(1084) + p.SetState(1090) p.expr(0) } - p.SetState(1089) + p.SetState(1095) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1085) + p.SetState(1091) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1086) + p.SetState(1092) p.expr(0) } - p.SetState(1091) + p.SetState(1097) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } { - p.SetState(1094) + 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(1098) + 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(1099) + p.SetState(1105) p.Match(SQLiteParserCOLLATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1100) + 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(1101) + 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(1103) + p.SetState(1109) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNOT_ { { - p.SetState(1102) + p.SetState(1108) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1105) + 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) @@ -13331,71 +14810,116 @@ func (p *SQLiteParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(1106) + p.SetState(1112) p.expr(0) } - p.SetState(1109) + p.SetState(1115) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 141, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 142, p.GetParserRuleContext()) == 1 { { - p.SetState(1107) + p.SetState(1113) p.Match(SQLiteParserESCAPE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1108) + 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(1111) + 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(1116) + p.SetState(1122) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserISNULL_: { - p.SetState(1112) + p.SetState(1118) p.Match(SQLiteParserISNULL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNOTNULL_: { - p.SetState(1113) + p.SetState(1119) p.Match(SQLiteParserNOTNULL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNOT_: { - p.SetState(1114) + p.SetState(1120) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1115) + 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(1122) + p.SetState(1128) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 144, 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. @@ -13421,23 +14945,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 @@ -13516,51 +15045,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(1123) + p.SetState(1129) p.Match(SQLiteParserRAISE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1124) + p.SetState(1130) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1129) + p.SetState(1135) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserIGNORE_: { - p.SetState(1125) + p.SetState(1131) p.Match(SQLiteParserIGNORE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserABORT_, SQLiteParserFAIL_, SQLiteParserROLLBACK_: { - p.SetState(1126) + p.SetState(1132) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserABORT_ || _la == SQLiteParserFAIL_ || _la == SQLiteParserROLLBACK_) { @@ -13571,23 +15096,42 @@ func (p *SQLiteParser) Raise_function() (localctx IRaise_functionContext) { } } { - p.SetState(1127) + p.SetState(1133) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1128) + 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(1131) + 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. @@ -13613,23 +15157,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 @@ -13696,35 +15245,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(1133) + 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) @@ -13732,7 +15262,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. @@ -13778,23 +15318,28 @@ type IInsert_stmtContext interface { } 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 @@ -14091,75 +15636,82 @@ 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() - }() - - 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(1208) + p.SetState(1214) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINSERT_, SQLiteParserREPLACE_, SQLiteParserWITH_: p.EnterOuterAlt(localctx, 1) - p.SetState(1136) + p.SetState(1142) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1135) + p.SetState(1141) p.With_clause() } } - p.SetState(1143) + p.SetState(1149) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 147, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 148, p.GetParserRuleContext()) { case 1: { - p.SetState(1138) + p.SetState(1144) p.Match(SQLiteParserINSERT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: { - p.SetState(1139) + p.SetState(1145) p.Match(SQLiteParserREPLACE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: { - p.SetState(1140) + p.SetState(1146) p.Match(SQLiteParserINSERT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1141) + p.SetState(1147) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1142) + p.SetState(1148) _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) @@ -14167,190 +15719,292 @@ func (p *SQLiteParser) Insert_stmt() (localctx IInsert_stmtContext) { } } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1145) + p.SetState(1151) p.Match(SQLiteParserINTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1149) + p.SetState(1155) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 148, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 149, p.GetParserRuleContext()) == 1 { { - p.SetState(1146) + p.SetState(1152) p.Schema_name() } { - p.SetState(1147) + p.SetState(1153) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1151) + p.SetState(1157) p.Table_name() } - p.SetState(1154) + p.SetState(1160) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1152) + p.SetState(1158) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1153) + p.SetState(1159) p.Table_alias() } } - p.SetState(1167) + p.SetState(1173) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { - p.SetState(1156) + p.SetState(1162) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1157) + p.SetState(1163) p.Column_name() } - p.SetState(1162) + p.SetState(1168) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1158) + p.SetState(1164) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1159) + p.SetState(1165) p.Column_name() } - p.SetState(1164) + p.SetState(1170) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1165) + p.SetState(1171) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } - p.SetState(1198) + p.SetState(1204) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 155, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 156, p.GetParserRuleContext()) { case 1: { - p.SetState(1169) + p.SetState(1175) p.Match(SQLiteParserVALUES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1170) + p.SetState(1176) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1171) + p.SetState(1177) p.expr(0) } - p.SetState(1176) + p.SetState(1182) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1172) + p.SetState(1178) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1173) + p.SetState(1179) p.expr(0) } - p.SetState(1178) + p.SetState(1184) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1179) + p.SetState(1185) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1194) + p.SetState(1200) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1180) + p.SetState(1186) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1181) + p.SetState(1187) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1182) + p.SetState(1188) p.expr(0) } - p.SetState(1187) + p.SetState(1193) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1183) + p.SetState(1189) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1184) + p.SetState(1190) p.expr(0) } - p.SetState(1189) + p.SetState(1195) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1190) + p.SetState(1196) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1196) + p.SetState(1202) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1197) + p.SetState(1203) p.Select_stmt() } + case antlr.ATNInvalidAltNumber: + goto errorExit } - p.SetState(1201) + p.SetState(1207) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserON_ { { - p.SetState(1200) + p.SetState(1206) p.Upsert_clause() } } - p.SetState(1204) + p.SetState(1210) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserRETURNING_ { { - p.SetState(1203) + p.SetState(1209) p.Returning_clause() } @@ -14359,19 +16013,38 @@ func (p *SQLiteParser) Insert_stmt() (localctx IInsert_stmtContext) { case SQLiteParserDEFAULT_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1206) + p.SetState(1212) p.Match(SQLiteParserDEFAULT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1207) + p.SetState(1213) p.Match(SQLiteParserVALUES_) + 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 } // IUpsert_clauseContext is an interface to support dynamic dispatch. @@ -14410,23 +16083,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 @@ -14677,84 +16355,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(1210) + p.SetState(1216) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1211) + p.SetState(1217) p.Match(SQLiteParserCONFLICT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1226) + p.SetState(1232) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOPEN_PAR { { - p.SetState(1212) + p.SetState(1218) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1213) + p.SetState(1219) p.Indexed_column() } - p.SetState(1218) + p.SetState(1224) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1214) + p.SetState(1220) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1215) + p.SetState(1221) p.Indexed_column() } - p.SetState(1220) + p.SetState(1226) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1221) + p.SetState(1227) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1224) + p.SetState(1230) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1222) + p.SetState(1228) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1223) + p.SetState(1229) p.expr(0) } @@ -14762,112 +16457,179 @@ func (p *SQLiteParser) Upsert_clause() (localctx IUpsert_clauseContext) { } { - p.SetState(1228) + p.SetState(1234) p.Match(SQLiteParserDO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1255) + p.SetState(1261) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserNOTHING_: { - p.SetState(1229) + p.SetState(1235) p.Match(SQLiteParserNOTHING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserUPDATE_: { - p.SetState(1230) + p.SetState(1236) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1231) + p.SetState(1237) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1234) + p.SetState(1240) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 162, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 163, p.GetParserRuleContext()) { case 1: { - p.SetState(1232) + p.SetState(1238) p.Column_name() } case 2: { - p.SetState(1233) + p.SetState(1239) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1236) + p.SetState(1242) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1237) + p.SetState(1243) p.expr(0) } - p.SetState(1248) + p.SetState(1254) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1238) + p.SetState(1244) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1241) + p.SetState(1247) 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(), 164, p.GetParserRuleContext()) { case 1: { - p.SetState(1239) + p.SetState(1245) p.Column_name() } case 2: { - p.SetState(1240) + p.SetState(1246) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1243) + p.SetState(1249) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1244) + p.SetState(1250) p.expr(0) } - p.SetState(1250) + p.SetState(1256) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1253) + p.SetState(1259) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1251) + p.SetState(1257) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1252) + p.SetState(1258) 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. @@ -14892,23 +16654,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 @@ -15007,77 +16774,81 @@ 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(1257) + p.SetState(1263) p.Match(SQLiteParserPRAGMA_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1261) + p.SetState(1267) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 167, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 168, p.GetParserRuleContext()) == 1 { { - p.SetState(1258) + p.SetState(1264) p.Schema_name() } { - p.SetState(1259) + p.SetState(1265) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1263) + p.SetState(1269) p.Pragma_name() } - p.SetState(1270) + p.SetState(1276) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserASSIGN: { - p.SetState(1264) + p.SetState(1270) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1265) + p.SetState(1271) p.Pragma_value() } case SQLiteParserOPEN_PAR: { - p.SetState(1266) + p.SetState(1272) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1267) + p.SetState(1273) p.Pragma_value() } { - p.SetState(1268) + p.SetState(1274) 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_: @@ -15085,7 +16856,17 @@ func (p *SQLiteParser) Pragma_stmt() (localctx IPragma_stmtContext) { 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. @@ -15105,23 +16886,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 @@ -15188,55 +16974,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(1275) + p.SetState(1281) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 169, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 170, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1272) + p.SetState(1278) p.Signed_number() } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1273) + p.SetState(1279) p.Name() } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1274) + p.SetState(1280) 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. @@ -15259,23 +17045,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 @@ -15378,77 +17169,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(1277) + p.SetState(1283) p.Match(SQLiteParserREINDEX_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1288) + p.SetState(1294) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 172, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 173, p.GetParserRuleContext()) == 1 { { - p.SetState(1278) + p.SetState(1284) p.Collation_name() } - } else if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 172, p.GetParserRuleContext()) == 2 { - p.SetState(1282) + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 173, p.GetParserRuleContext()) == 2 { + p.SetState(1288) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 170, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 171, p.GetParserRuleContext()) == 1 { { - p.SetState(1279) + p.SetState(1285) p.Schema_name() } { - p.SetState(1280) + p.SetState(1286) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1286) + p.SetState(1292) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 171, p.GetParserRuleContext()) { + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 172, p.GetParserRuleContext()) { case 1: { - p.SetState(1284) + p.SetState(1290) p.Table_name() } case 2: { - p.SetState(1285) + p.SetState(1291) 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. @@ -15472,23 +17273,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 @@ -15649,91 +17455,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(1291) + p.SetState(1297) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1290) + p.SetState(1296) p.Common_table_stmt() } } { - p.SetState(1293) + p.SetState(1299) p.Select_core() } - p.SetState(1299) + p.SetState(1305) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 174, p.GetParserRuleContext()) - + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 175, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(1294) + p.SetState(1300) p.Compound_operator() } { - p.SetState(1295) + p.SetState(1301) p.Select_core() } } - p.SetState(1301) + p.SetState(1307) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 174, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 175, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } } - p.SetState(1303) + p.SetState(1309) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1302) + p.SetState(1308) p.Order_by_stmt() } } - p.SetState(1306) + p.SetState(1312) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ { { - p.SetState(1305) + p.SetState(1311) 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. @@ -15756,23 +17573,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 @@ -15926,64 +17748,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(1308) + p.SetState(1314) p.Table_or_subquery() } - p.SetState(1316) + p.SetState(1321) 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(1309) + p.SetState(1315) p.Join_operator() } { - p.SetState(1310) + p.SetState(1316) p.Table_or_subquery() } - p.SetState(1312) - p.GetErrorHandler().Sync(p) - - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 177, p.GetParserRuleContext()) == 1 { - { - p.SetState(1311) - p.Join_constraint() - } - + { + p.SetState(1317) + p.Join_constraint() } - p.SetState(1318) + p.SetState(1323) 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. @@ -16029,23 +17842,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 @@ -16369,45 +18187,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(1409) + p.SetState(1414) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserSELECT_: p.EnterOuterAlt(localctx, 1) { - p.SetState(1319) + p.SetState(1324) p.Match(SQLiteParserSELECT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1321) + p.SetState(1326) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 179, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 179, p.GetParserRuleContext()) == 1 { { - p.SetState(1320) + p.SetState(1325) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserALL_ || _la == SQLiteParserDISTINCT_) { @@ -16418,186 +18224,281 @@ func (p *SQLiteParser) Select_core() (localctx ISelect_coreContext) { } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1323) + p.SetState(1328) p.Result_column() } - p.SetState(1328) + p.SetState(1333) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1324) + p.SetState(1329) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1325) + p.SetState(1330) p.Result_column() } - p.SetState(1330) + p.SetState(1335) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1343) + p.SetState(1348) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFROM_ { { - p.SetState(1331) + p.SetState(1336) p.Match(SQLiteParserFROM_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1341) + p.SetState(1346) 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(), 182, p.GetParserRuleContext()) { case 1: { - p.SetState(1332) + p.SetState(1337) p.Table_or_subquery() } - p.SetState(1337) + p.SetState(1342) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1333) + p.SetState(1338) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1334) + p.SetState(1339) p.Table_or_subquery() } - p.SetState(1339) + p.SetState(1344) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1340) + p.SetState(1345) p.Join_clause() } + case antlr.ATNInvalidAltNumber: + goto errorExit } } - p.SetState(1347) + p.SetState(1352) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1345) + p.SetState(1350) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1346) + p.SetState(1351) p.expr(0) } } - p.SetState(1363) + p.SetState(1368) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserGROUP_ { { - p.SetState(1349) + p.SetState(1354) p.Match(SQLiteParserGROUP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1350) + p.SetState(1355) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1351) + p.SetState(1356) p.expr(0) } - p.SetState(1356) + p.SetState(1361) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1352) + p.SetState(1357) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1353) + p.SetState(1358) p.expr(0) } - p.SetState(1358) + p.SetState(1363) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1361) + p.SetState(1366) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserHAVING_ { { - p.SetState(1359) + p.SetState(1364) p.Match(SQLiteParserHAVING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1360) + p.SetState(1365) p.expr(0) } } } - p.SetState(1379) + p.SetState(1384) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWINDOW_ { { - p.SetState(1365) + p.SetState(1370) p.Match(SQLiteParserWINDOW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1366) + p.SetState(1371) p.Window_name() } { - p.SetState(1367) + p.SetState(1372) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1368) + p.SetState(1373) p.Window_defn() } - p.SetState(1376) + p.SetState(1381) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1369) + p.SetState(1374) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1370) + p.SetState(1375) p.Window_name() } { - p.SetState(1371) + p.SetState(1376) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1372) + p.SetState(1377) p.Window_defn() } - p.SetState(1378) + p.SetState(1383) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } @@ -16606,89 +18507,150 @@ func (p *SQLiteParser) Select_core() (localctx ISelect_coreContext) { case SQLiteParserVALUES_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1381) + p.SetState(1386) p.Match(SQLiteParserVALUES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1382) + p.SetState(1387) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1383) + p.SetState(1388) p.expr(0) } - p.SetState(1388) + p.SetState(1393) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1384) + p.SetState(1389) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1385) + p.SetState(1390) p.expr(0) } - p.SetState(1390) + p.SetState(1395) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1391) + p.SetState(1396) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1406) + p.SetState(1411) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1392) + p.SetState(1397) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1393) + p.SetState(1398) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1394) + p.SetState(1399) p.expr(0) } - p.SetState(1399) + p.SetState(1404) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1395) + p.SetState(1400) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1396) + p.SetState(1401) p.expr(0) } - p.SetState(1401) + p.SetState(1406) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1402) + p.SetState(1407) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1408) + p.SetState(1413) 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. @@ -16706,23 +18668,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 @@ -16769,35 +18736,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(1411) + p.SetState(1416) 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. @@ -16818,23 +18775,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 @@ -16929,69 +18891,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(1414) + p.SetState(1419) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1413) + p.SetState(1418) p.Common_table_stmt() } } { - p.SetState(1416) + p.SetState(1421) p.Select_core() } - p.SetState(1418) + p.SetState(1423) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1417) + p.SetState(1422) p.Order_by_stmt() } } - p.SetState(1421) + p.SetState(1426) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ { { - p.SetState(1420) + p.SetState(1425) 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. @@ -17021,23 +18983,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 @@ -17189,119 +19156,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(1424) + p.SetState(1429) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1423) + p.SetState(1428) p.Common_table_stmt() } } { - p.SetState(1426) + p.SetState(1431) p.Select_core() } - p.SetState(1436) + p.SetState(1441) 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(1433) + p.SetState(1438) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserUNION_: { - p.SetState(1427) + p.SetState(1432) p.Match(SQLiteParserUNION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1429) + p.SetState(1434) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserALL_ { { - p.SetState(1428) + p.SetState(1433) p.Match(SQLiteParserALL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } case SQLiteParserINTERSECT_: { - p.SetState(1431) + p.SetState(1436) p.Match(SQLiteParserINTERSECT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserEXCEPT_: { - p.SetState(1432) + p.SetState(1437) 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(1435) + p.SetState(1440) p.Select_core() } - p.SetState(1438) + p.SetState(1443) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1441) + p.SetState(1446) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1440) + p.SetState(1445) p.Order_by_stmt() } } - p.SetState(1444) + p.SetState(1449) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ { { - p.SetState(1443) + p.SetState(1448) 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. @@ -17339,23 +19335,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 @@ -17632,100 +19633,119 @@ 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(1574) + p.SetState(1579) 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(), 227, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) - p.SetState(1449) + p.SetState(1454) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 203, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 203, p.GetParserRuleContext()) == 1 { { - p.SetState(1446) + p.SetState(1451) p.Schema_name() } { - p.SetState(1447) + p.SetState(1452) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1451) + p.SetState(1456) p.Table_name() } - p.SetState(1456) + p.SetState(1461) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1453) + p.SetState(1458) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1452) + p.SetState(1457) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1455) + p.SetState(1460) p.Table_alias() } } - p.SetState(1463) + p.SetState(1468) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINDEXED_: { - p.SetState(1458) + p.SetState(1463) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1459) + p.SetState(1464) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1460) + p.SetState(1465) p.Index_name() } case SQLiteParserNOT_: { - p.SetState(1461) + p.SetState(1466) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1462) + p.SetState(1467) 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_: @@ -17735,72 +19755,106 @@ func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) case 2: p.EnterOuterAlt(localctx, 2) - p.SetState(1468) + p.SetState(1473) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 207, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 207, p.GetParserRuleContext()) == 1 { { - p.SetState(1465) + p.SetState(1470) p.Schema_name() } { - p.SetState(1466) + p.SetState(1471) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1470) + p.SetState(1475) p.Table_function_name() } { - p.SetState(1471) + p.SetState(1476) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1472) + p.SetState(1477) p.expr(0) } - p.SetState(1477) + p.SetState(1482) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1473) + p.SetState(1478) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1474) + p.SetState(1479) p.expr(0) } - p.SetState(1479) + p.SetState(1484) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1480) + p.SetState(1485) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1485) + p.SetState(1490) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1482) + p.SetState(1487) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1481) + p.SetState(1486) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1484) + p.SetState(1489) p.Table_alias() } @@ -17809,80 +19863,122 @@ func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1487) + p.SetState(1492) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1497) + p.SetState(1502) 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(), 212, p.GetParserRuleContext()) { case 1: { - p.SetState(1488) + p.SetState(1493) p.Table_or_subquery() } - p.SetState(1493) + p.SetState(1498) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1489) + p.SetState(1494) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1490) + p.SetState(1495) p.Table_or_subquery() } - p.SetState(1495) + p.SetState(1500) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1496) + p.SetState(1501) p.Join_clause() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1499) + p.SetState(1504) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(1501) + p.SetState(1506) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1502) + p.SetState(1507) p.Select_stmt() } { - p.SetState(1503) + p.SetState(1508) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1508) + p.SetState(1513) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1505) + p.SetState(1510) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1504) + p.SetState(1509) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1507) + p.SetState(1512) p.Table_alias() } @@ -17890,70 +19986,102 @@ func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) case 5: p.EnterOuterAlt(localctx, 5) - p.SetState(1513) + p.SetState(1518) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 215, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 215, p.GetParserRuleContext()) == 1 { { - p.SetState(1510) + p.SetState(1515) p.Schema_name() } { - p.SetState(1511) + p.SetState(1516) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1515) + p.SetState(1520) p.Table_name() } - p.SetState(1520) + p.SetState(1525) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 217, p.GetParserRuleContext()) == 1 { - p.SetState(1517) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 217, p.GetParserRuleContext()) == 1 { + p.SetState(1522) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 216, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 216, p.GetParserRuleContext()) == 1 { { - p.SetState(1516) + p.SetState(1521) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1519) + p.SetState(1524) p.Table_alias_fallback() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1527) + p.SetState(1532) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINDEXED_: { - p.SetState(1522) + p.SetState(1527) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1523) + p.SetState(1528) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1524) + p.SetState(1529) p.Index_name() } case SQLiteParserNOT_: { - p.SetState(1525) + p.SetState(1530) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1526) + p.SetState(1531) 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_: @@ -17963,158 +20091,242 @@ func (p *SQLiteParser) Table_or_subquery() (localctx ITable_or_subqueryContext) case 6: p.EnterOuterAlt(localctx, 6) - p.SetState(1532) + p.SetState(1537) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 219, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 219, p.GetParserRuleContext()) == 1 { { - p.SetState(1529) + p.SetState(1534) p.Schema_name() } { - p.SetState(1530) + p.SetState(1535) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1534) + p.SetState(1539) p.Table_function_name() } { - p.SetState(1535) + p.SetState(1540) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1536) + p.SetState(1541) p.expr(0) } - p.SetState(1541) + p.SetState(1546) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1537) + p.SetState(1542) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1538) + p.SetState(1543) p.expr(0) } - p.SetState(1543) + p.SetState(1548) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1544) + p.SetState(1549) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1549) + p.SetState(1554) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 222, p.GetParserRuleContext()) == 1 { - p.SetState(1546) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 222, p.GetParserRuleContext()) == 1 { + p.SetState(1551) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 221, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 221, p.GetParserRuleContext()) == 1 { { - p.SetState(1545) + p.SetState(1550) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1548) + p.SetState(1553) p.Table_alias_fallback() } + } else if p.HasError() { // JIM + goto errorExit } case 7: p.EnterOuterAlt(localctx, 7) { - p.SetState(1551) + p.SetState(1556) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1561) + p.SetState(1566) 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(), 224, p.GetParserRuleContext()) { case 1: { - p.SetState(1552) + p.SetState(1557) p.Table_or_subquery() } - p.SetState(1557) + p.SetState(1562) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1553) + p.SetState(1558) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1554) + p.SetState(1559) p.Table_or_subquery() } - p.SetState(1559) + p.SetState(1564) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case 2: { - p.SetState(1560) + p.SetState(1565) p.Join_clause() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1563) + p.SetState(1568) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 8: p.EnterOuterAlt(localctx, 8) { - p.SetState(1565) + p.SetState(1570) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1566) + p.SetState(1571) p.Select_stmt() } { - p.SetState(1567) + p.SetState(1572) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1572) + p.SetState(1577) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 226, p.GetParserRuleContext()) == 1 { - p.SetState(1569) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 226, p.GetParserRuleContext()) == 1 { + p.SetState(1574) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 225, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 225, p.GetParserRuleContext()) == 1 { { - p.SetState(1568) + p.SetState(1573) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1571) + p.SetState(1576) 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. @@ -18137,23 +20349,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 @@ -18244,86 +20461,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(1588) + p.SetState(1593) 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(), 230, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1576) + p.SetState(1581) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1577) + p.SetState(1582) p.Table_name() } { - p.SetState(1578) + p.SetState(1583) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1579) + p.SetState(1584) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1581) + p.SetState(1586) p.expr(0) } - p.SetState(1586) + p.SetState(1591) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ || _la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL { - p.SetState(1583) + p.SetState(1588) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1582) + p.SetState(1587) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } { - p.SetState(1585) + p.SetState(1590) 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. @@ -18349,23 +20585,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 @@ -18432,85 +20673,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(1604) + p.SetState(1609) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserCOMMA: p.EnterOuterAlt(localctx, 1) { - p.SetState(1590) + p.SetState(1595) 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(1592) + p.SetState(1597) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNATURAL_ { { - p.SetState(1591) + p.SetState(1596) p.Match(SQLiteParserNATURAL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } - p.SetState(1599) + p.SetState(1604) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserFULL_, SQLiteParserLEFT_, SQLiteParserRIGHT_: { - p.SetState(1594) + p.SetState(1599) _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(1596) + p.SetState(1601) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserOUTER_ { { - p.SetState(1595) + p.SetState(1600) p.Match(SQLiteParserOUTER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } case SQLiteParserINNER_: { - p.SetState(1598) + p.SetState(1603) p.Match(SQLiteParserINNER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserJOIN_: @@ -18518,26 +20767,49 @@ func (p *SQLiteParser) Join_operator() (localctx IJoin_operatorContext) { default: } { - p.SetState(1601) + p.SetState(1606) p.Match(SQLiteParserJOIN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCROSS_: p.EnterOuterAlt(localctx, 3) { - p.SetState(1602) + p.SetState(1607) p.Match(SQLiteParserCROSS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1603) + p.SetState(1608) 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. @@ -18563,23 +20835,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 @@ -18691,86 +20968,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.SetState(1620) + p.EnterOuterAlt(localctx, 1) + p.SetState(1625) p.GetErrorHandler().Sync(p) - switch p.GetTokenStream().LA(1) { - case SQLiteParserON_: - p.EnterOuterAlt(localctx, 1) + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 236, p.GetParserRuleContext()) == 1 { { - p.SetState(1606) + p.SetState(1611) p.Match(SQLiteParserON_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1607) + p.SetState(1612) p.expr(0) } - case SQLiteParserUSING_: - p.EnterOuterAlt(localctx, 2) + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 236, p.GetParserRuleContext()) == 2 { { - p.SetState(1608) + p.SetState(1613) p.Match(SQLiteParserUSING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1609) + p.SetState(1614) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1610) + p.SetState(1615) p.Column_name() } - p.SetState(1615) + p.SetState(1620) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1611) + p.SetState(1616) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1612) + p.SetState(1617) p.Column_name() } - p.SetState(1617) + p.SetState(1622) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1618) + p.SetState(1623) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - default: - panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + } 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. @@ -18791,23 +21085,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 @@ -18854,47 +21153,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(1628) + p.SetState(1633) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserUNION_: p.EnterOuterAlt(localctx, 1) { - p.SetState(1622) + p.SetState(1627) p.Match(SQLiteParserUNION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1624) + p.SetState(1629) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserALL_ { { - p.SetState(1623) + p.SetState(1628) p.Match(SQLiteParserALL_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } } @@ -18902,22 +21196,41 @@ func (p *SQLiteParser) Compound_operator() (localctx ICompound_operatorContext) case SQLiteParserINTERSECT_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1626) + p.SetState(1631) p.Match(SQLiteParserINTERSECT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserEXCEPT_: p.EnterOuterAlt(localctx, 3) { - p.SetState(1627) + p.SetState(1632) 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. @@ -18956,23 +21269,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 @@ -19226,58 +21544,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(1631) + p.SetState(1636) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1630) + p.SetState(1635) p.With_clause() } } { - p.SetState(1633) + p.SetState(1638) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1636) + p.SetState(1641) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 240, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 240, p.GetParserRuleContext()) == 1 { { - p.SetState(1634) + p.SetState(1639) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1635) + p.SetState(1640) _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) @@ -19285,105 +21595,161 @@ func (p *SQLiteParser) Update_stmt() (localctx IUpdate_stmtContext) { } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1638) + p.SetState(1643) p.Qualified_table_name() } { - p.SetState(1639) + p.SetState(1644) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1642) + p.SetState(1647) 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(), 241, p.GetParserRuleContext()) { case 1: { - p.SetState(1640) + p.SetState(1645) p.Column_name() } case 2: { - p.SetState(1641) + p.SetState(1646) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1644) + p.SetState(1649) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1645) + p.SetState(1650) p.expr(0) } - p.SetState(1656) + p.SetState(1661) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1646) + p.SetState(1651) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1649) + p.SetState(1654) 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(), 242, p.GetParserRuleContext()) { case 1: { - p.SetState(1647) + p.SetState(1652) p.Column_name() } case 2: { - p.SetState(1648) + p.SetState(1653) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1651) + p.SetState(1656) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1652) + p.SetState(1657) p.expr(0) } - p.SetState(1658) + p.SetState(1663) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1661) + p.SetState(1666) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1659) + p.SetState(1664) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1660) + p.SetState(1665) p.expr(0) } } - p.SetState(1664) + p.SetState(1669) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserRETURNING_ { { - p.SetState(1663) + p.SetState(1668) 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. @@ -19406,23 +21772,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 @@ -19510,62 +21881,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(1666) + p.SetState(1671) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1667) + p.SetState(1672) p.Column_name() } - p.SetState(1672) + p.SetState(1677) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1668) + p.SetState(1673) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1669) + p.SetState(1674) p.Column_name() } - p.SetState(1674) + p.SetState(1679) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } { - p.SetState(1675) + p.SetState(1680) 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. @@ -19605,23 +21985,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 @@ -19891,58 +22276,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(1678) + p.SetState(1683) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWITH_ { { - p.SetState(1677) + p.SetState(1682) p.With_clause() } } { - p.SetState(1680) + p.SetState(1685) p.Match(SQLiteParserUPDATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1683) + p.SetState(1688) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 248, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 248, p.GetParserRuleContext()) == 1 { { - p.SetState(1681) + p.SetState(1686) p.Match(SQLiteParserOR_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1682) + p.SetState(1687) _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) @@ -19950,116 +22327,175 @@ func (p *SQLiteParser) Update_stmt_limited() (localctx IUpdate_stmt_limitedConte } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1685) + p.SetState(1690) p.Qualified_table_name() } { - p.SetState(1686) + p.SetState(1691) p.Match(SQLiteParserSET_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1689) + p.SetState(1694) 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(), 249, p.GetParserRuleContext()) { case 1: { - p.SetState(1687) + p.SetState(1692) p.Column_name() } case 2: { - p.SetState(1688) + p.SetState(1693) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1691) + p.SetState(1696) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1692) + p.SetState(1697) p.expr(0) } - p.SetState(1703) + p.SetState(1708) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1693) + p.SetState(1698) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1696) + p.SetState(1701) 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(), 250, p.GetParserRuleContext()) { case 1: { - p.SetState(1694) + p.SetState(1699) p.Column_name() } case 2: { - p.SetState(1695) + p.SetState(1700) p.Column_name_list() } + case antlr.ATNInvalidAltNumber: + goto errorExit } { - p.SetState(1698) + p.SetState(1703) p.Match(SQLiteParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1699) + p.SetState(1704) p.expr(0) } - p.SetState(1705) + p.SetState(1710) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1708) + p.SetState(1713) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserWHERE_ { { - p.SetState(1706) + p.SetState(1711) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1707) + p.SetState(1712) p.expr(0) } } - p.SetState(1714) + p.SetState(1719) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserLIMIT_ || _la == SQLiteParserORDER_ { - p.SetState(1711) + p.SetState(1716) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1710) + p.SetState(1715) p.Order_by_stmt() } } { - p.SetState(1713) + p.SetState(1718) 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. @@ -20085,23 +22521,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 @@ -20216,89 +22657,101 @@ 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(1719) + p.SetState(1724) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 255, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 255, p.GetParserRuleContext()) == 1 { { - p.SetState(1716) + p.SetState(1721) p.Schema_name() } { - p.SetState(1717) + p.SetState(1722) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1721) + p.SetState(1726) p.Table_name() } - p.SetState(1724) + p.SetState(1729) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserAS_ { { - p.SetState(1722) + p.SetState(1727) p.Match(SQLiteParserAS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1723) + p.SetState(1728) p.Alias() } } - p.SetState(1731) + p.SetState(1736) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserINDEXED_: { - p.SetState(1726) + p.SetState(1731) p.Match(SQLiteParserINDEXED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1727) + p.SetState(1732) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1728) + p.SetState(1733) p.Index_name() } case SQLiteParserNOT_: { - p.SetState(1729) + p.SetState(1734) p.Match(SQLiteParserNOT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1730) + p.SetState(1735) 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_: @@ -20306,7 +22759,17 @@ func (p *SQLiteParser) Qualified_table_name() (localctx IQualified_table_nameCon 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. @@ -20327,23 +22790,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 @@ -20414,61 +22882,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(1733) + p.SetState(1738) p.Match(SQLiteParserVACUUM_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1735) + p.SetState(1740) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 258, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 258, p.GetParserRuleContext()) == 1 { { - p.SetState(1734) + p.SetState(1739) p.Schema_name() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1739) + p.SetState(1744) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserINTO_ { { - p.SetState(1737) + p.SetState(1742) p.Match(SQLiteParserINTO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1738) + p.SetState(1743) 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. @@ -20490,23 +22962,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 @@ -20569,51 +23046,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(1741) + p.SetState(1746) p.Match(SQLiteParserFILTER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1742) + p.SetState(1747) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1743) + p.SetState(1748) p.Match(SQLiteParserWHERE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1744) + p.SetState(1749) p.expr(0) } { - p.SetState(1745) + p.SetState(1750) 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. @@ -20644,23 +23127,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 @@ -20837,130 +23325,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.EnterOuterAlt(localctx, 1) { - p.SetState(1747) + p.SetState(1752) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1749) + p.SetState(1754) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 260, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 260, p.GetParserRuleContext()) == 1 { { - p.SetState(1748) + p.SetState(1753) p.Base_window_name() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1761) + p.SetState(1766) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1751) + p.SetState(1756) p.Match(SQLiteParserPARTITION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1752) + p.SetState(1757) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1753) + p.SetState(1758) p.expr(0) } - p.SetState(1758) + p.SetState(1763) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1754) + p.SetState(1759) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1755) + p.SetState(1760) p.expr(0) } - p.SetState(1760) + p.SetState(1765) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } { - p.SetState(1763) + p.SetState(1768) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1764) + p.SetState(1769) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1765) + p.SetState(1770) p.Ordering_term() } - p.SetState(1770) + p.SetState(1775) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1766) + p.SetState(1771) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1767) + p.SetState(1772) p.Ordering_term() } - p.SetState(1772) + p.SetState(1777) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } - p.SetState(1774) + p.SetState(1779) 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(1773) + p.SetState(1778) p.Frame_spec() } } { - p.SetState(1776) + p.SetState(1781) 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. @@ -20993,23 +23524,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 @@ -21206,151 +23742,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(1778) + p.SetState(1783) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1812) + p.SetState(1817) 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(), 271, p.GetParserRuleContext()) { case 1: { - p.SetState(1779) + p.SetState(1784) p.Window_name() } case 2: { - p.SetState(1780) + p.SetState(1785) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1782) + p.SetState(1787) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 265, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 265, p.GetParserRuleContext()) == 1 { { - p.SetState(1781) + p.SetState(1786) p.Base_window_name() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(1794) + p.SetState(1799) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1784) + p.SetState(1789) p.Match(SQLiteParserPARTITION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1785) + p.SetState(1790) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1786) + p.SetState(1791) p.expr(0) } - p.SetState(1791) + p.SetState(1796) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1787) + p.SetState(1792) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1788) + p.SetState(1793) p.expr(0) } - p.SetState(1793) + p.SetState(1798) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } - p.SetState(1806) + p.SetState(1811) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1796) + p.SetState(1801) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1797) + p.SetState(1802) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1798) + p.SetState(1803) p.Ordering_term() } - p.SetState(1803) + p.SetState(1808) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1799) + p.SetState(1804) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1800) + p.SetState(1805) p.Ordering_term() } - p.SetState(1805) + p.SetState(1810) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } } - p.SetState(1809) + p.SetState(1814) 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(1808) + p.SetState(1813) p.Frame_spec() } } { - p.SetState(1811) + p.SetState(1816) 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. @@ -21375,23 +23967,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 @@ -21466,72 +24063,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(1814) + p.SetState(1819) p.Frame_clause() } - p.SetState(1822) + p.SetState(1827) p.GetErrorHandler().Sync(p) - + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserEXCLUDE_: { - p.SetState(1815) + p.SetState(1820) p.Match(SQLiteParserEXCLUDE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1816) + p.SetState(1821) p.Match(SQLiteParserNO_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1817) + p.SetState(1822) p.Match(SQLiteParserOTHERS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCURRENT_: { - p.SetState(1818) + p.SetState(1823) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1819) + p.SetState(1824) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserGROUP_: { - p.SetState(1820) + p.SetState(1825) p.Match(SQLiteParserGROUP_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserTIES_: { - p.SetState(1821) + p.SetState(1826) p.Match(SQLiteParserTIES_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -21539,7 +24146,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. @@ -21564,23 +24181,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 @@ -21679,71 +24301,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(1824) + p.SetState(1829) _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(1831) + p.SetState(1836) 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(), 273, p.GetParserRuleContext()) { case 1: { - p.SetState(1825) + p.SetState(1830) p.Frame_single() } case 2: { - p.SetState(1826) + p.SetState(1831) p.Match(SQLiteParserBETWEEN_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1827) + p.SetState(1832) p.Frame_left() } { - p.SetState(1828) + p.SetState(1833) p.Match(SQLiteParserAND_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1829) + p.SetState(1834) 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. @@ -21768,23 +24395,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 @@ -21892,81 +24524,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(1833) + p.SetState(1838) p.Simple_func() } { - p.SetState(1834) + p.SetState(1839) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1844) + p.SetState(1849) 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(1835) + p.SetState(1840) p.expr(0) } - p.SetState(1840) + p.SetState(1845) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1836) + p.SetState(1841) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1837) + p.SetState(1842) p.expr(0) } - p.SetState(1842) + p.SetState(1847) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case SQLiteParserSTAR: { - p.SetState(1843) + p.SetState(1848) 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(1846) + p.SetState(1851) 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. @@ -21993,23 +24642,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 @@ -22137,80 +24791,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(1848) + p.SetState(1853) p.Aggregate_func() } { - p.SetState(1849) + p.SetState(1854) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1862) + p.SetState(1867) 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(1851) + p.SetState(1856) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 276, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 276, p.GetParserRuleContext()) == 1 { { - p.SetState(1850) + p.SetState(1855) p.Match(SQLiteParserDISTINCT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1853) + p.SetState(1858) p.expr(0) } - p.SetState(1858) + p.SetState(1863) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1854) + p.SetState(1859) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1855) + p.SetState(1860) p.expr(0) } - p.SetState(1860) + p.SetState(1865) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case SQLiteParserSTAR: { - p.SetState(1861) + p.SetState(1866) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -22218,22 +24879,39 @@ func (p *SQLiteParser) Aggregate_function_invocation() (localctx IAggregate_func default: } { - p.SetState(1864) + p.SetState(1869) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1866) + p.SetState(1871) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFILTER_ { { - p.SetState(1865) + p.SetState(1870) 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. @@ -22262,23 +24940,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 @@ -22438,70 +25121,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(1868) + p.SetState(1873) p.Window_function() } { - p.SetState(1869) + p.SetState(1874) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1879) + p.SetState(1884) 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(1870) + p.SetState(1875) p.expr(0) } - p.SetState(1875) + p.SetState(1880) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1871) + p.SetState(1876) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1872) + p.SetState(1877) p.expr(0) } - p.SetState(1877) + p.SetState(1882) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) } case SQLiteParserSTAR: { - p.SetState(1878) + p.SetState(1883) p.Match(SQLiteParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCLOSE_PAR: @@ -22509,42 +25193,69 @@ func (p *SQLiteParser) Window_function_invocation() (localctx IWindow_function_i default: } { - p.SetState(1881) + p.SetState(1886) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1883) + p.SetState(1888) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserFILTER_ { { - p.SetState(1882) + p.SetState(1887) p.Filter_clause() } } { - p.SetState(1885) + p.SetState(1890) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1888) + p.SetState(1893) 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(), 283, p.GetParserRuleContext()) { case 1: { - p.SetState(1886) + p.SetState(1891) p.Window_defn() } case 2: { - p.SetState(1887) + p.SetState(1892) 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. @@ -22567,23 +25278,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 @@ -22671,68 +25387,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(1890) + p.SetState(1895) p.Match(SQLiteParserWITH_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1892) + p.SetState(1897) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 284, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 284, p.GetParserRuleContext()) == 1 { { - p.SetState(1891) + p.SetState(1896) p.Match(SQLiteParserRECURSIVE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(1894) + p.SetState(1899) p.Common_table_expression() } - p.SetState(1899) + p.SetState(1904) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1895) + p.SetState(1900) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1896) + p.SetState(1901) p.Common_table_expression() } - p.SetState(1901) + p.SetState(1906) 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. @@ -22755,23 +25482,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 @@ -22859,62 +25591,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(1902) + p.SetState(1907) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1903) + p.SetState(1908) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1904) + p.SetState(1909) p.Ordering_term() } - p.SetState(1909) + p.SetState(1914) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(1905) + p.SetState(1910) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1906) + p.SetState(1911) p.Ordering_term() } - p.SetState(1911) + p.SetState(1916) 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. @@ -22936,23 +25677,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 @@ -23036,45 +25782,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(1912) + p.SetState(1917) p.Match(SQLiteParserLIMIT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1913) + p.SetState(1918) p.expr(0) } - p.SetState(1916) + p.SetState(1921) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOMMA || _la == SQLiteParserOFFSET_ { { - p.SetState(1914) + p.SetState(1919) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserCOMMA || _la == SQLiteParserOFFSET_) { @@ -23085,13 +25819,23 @@ func (p *SQLiteParser) Limit_stmt() (localctx ILimit_stmtContext) { } } { - p.SetState(1915) + p.SetState(1920) 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. @@ -23115,23 +25859,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 @@ -23226,71 +25975,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(1918) + p.SetState(1923) p.expr(0) } - p.SetState(1921) + p.SetState(1926) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOLLATE_ { { - p.SetState(1919) + p.SetState(1924) p.Match(SQLiteParserCOLLATE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1920) + p.SetState(1925) p.Collation_name() } } - p.SetState(1924) + p.SetState(1929) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { { - p.SetState(1923) + p.SetState(1928) p.Asc_desc() } } - p.SetState(1928) + p.SetState(1933) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserNULLS_ { { - p.SetState(1926) + p.SetState(1931) p.Match(SQLiteParserNULLS_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1927) + p.SetState(1932) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserFIRST_ || _la == SQLiteParserLAST_) { @@ -23303,7 +26050,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. @@ -23322,23 +26079,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 @@ -23377,32 +26139,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(1930) + p.SetState(1935) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserASC_ || _la == SQLiteParserDESC_) { @@ -23413,7 +26156,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. @@ -23436,23 +26189,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 @@ -23519,78 +26277,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(1942) + p.SetState(1947) 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(), 291, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1932) + p.SetState(1937) p.expr(0) } { - p.SetState(1933) + p.SetState(1938) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1935) + p.SetState(1940) p.expr(0) } { - p.SetState(1936) + p.SetState(1941) p.Match(SQLiteParserFOLLOWING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1938) + p.SetState(1943) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1939) + p.SetState(1944) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(1940) + p.SetState(1945) p.Match(SQLiteParserUNBOUNDED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1941) + p.SetState(1946) 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. @@ -23613,23 +26391,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 @@ -23696,78 +26479,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(1954) + p.SetState(1959) 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(), 292, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1944) + p.SetState(1949) p.expr(0) } { - p.SetState(1945) + p.SetState(1950) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1947) + p.SetState(1952) p.expr(0) } { - p.SetState(1948) + p.SetState(1953) p.Match(SQLiteParserFOLLOWING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1950) + p.SetState(1955) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1951) + p.SetState(1956) p.Match(SQLiteParserROW_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 4: p.EnterOuterAlt(localctx, 4) { - p.SetState(1952) + p.SetState(1957) p.Match(SQLiteParserUNBOUNDED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1953) + p.SetState(1958) 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. @@ -23789,23 +26592,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 @@ -23868,67 +26676,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(1963) + p.SetState(1968) 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(), 293, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(1956) + p.SetState(1961) p.expr(0) } { - p.SetState(1957) + p.SetState(1962) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(1959) + p.SetState(1964) p.Match(SQLiteParserUNBOUNDED_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1960) + p.SetState(1965) p.Match(SQLiteParserPRECEDING_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case 3: p.EnterOuterAlt(localctx, 3) { - p.SetState(1961) + p.SetState(1966) p.Match(SQLiteParserCURRENT_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1962) + p.SetState(1967) 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. @@ -23970,23 +26794,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 @@ -24213,37 +27042,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(2050) + p.SetState(2055) 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(1965) + p.SetState(1970) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserFIRST_VALUE_ || _la == SQLiteParserLAST_VALUE_) { @@ -24254,60 +27067,86 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(1966) + p.SetState(1971) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1967) + p.SetState(1972) p.expr(0) } { - p.SetState(1968) + p.SetState(1973) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1969) + p.SetState(1974) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1970) + p.SetState(1975) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1972) + p.SetState(1977) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1971) + p.SetState(1976) p.Partition_by() } } { - p.SetState(1974) + p.SetState(1979) p.Order_by_expr_asc_desc() } - p.SetState(1976) + p.SetState(1981) 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(1975) + p.SetState(1980) p.Frame_clause() } } { - p.SetState(1978) + p.SetState(1983) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserCUME_DIST_, SQLiteParserPERCENT_RANK_: p.EnterOuterAlt(localctx, 2) { - p.SetState(1980) + p.SetState(1985) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserCUME_DIST_ || _la == SQLiteParserPERCENT_RANK_) { @@ -24318,55 +27157,81 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(1981) + p.SetState(1986) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1982) + p.SetState(1987) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1983) + p.SetState(1988) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1984) + p.SetState(1989) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1986) + p.SetState(1991) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1985) + p.SetState(1990) p.Partition_by() } } - p.SetState(1989) + p.SetState(1994) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserORDER_ { { - p.SetState(1988) + p.SetState(1993) p.Order_by_expr() } } { - p.SetState(1991) + p.SetState(1996) 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(1992) + p.SetState(1997) _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) @@ -24374,45 +27239,68 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(1993) + p.SetState(1998) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1994) + p.SetState(1999) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1995) + p.SetState(2000) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(1996) + p.SetState(2001) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(1998) + p.SetState(2003) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(1997) + p.SetState(2002) p.Partition_by() } } { - p.SetState(2000) + p.SetState(2005) p.Order_by_expr_asc_desc() } { - p.SetState(2001) + p.SetState(2006) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserLAG_, SQLiteParserLEAD_: p.EnterOuterAlt(localctx, 4) { - p.SetState(2003) + p.SetState(2008) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserLAG_ || _la == SQLiteParserLEAD_) { @@ -24423,182 +27311,282 @@ func (p *SQLiteParser) Window_function() (localctx IWindow_functionContext) { } } { - p.SetState(2004) + p.SetState(2009) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2005) + p.SetState(2010) p.expr(0) } - p.SetState(2007) + p.SetState(2012) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 299, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 299, p.GetParserRuleContext()) == 1 { { - p.SetState(2006) + p.SetState(2011) p.Of_OF_fset() } + } else if p.HasError() { // JIM + goto errorExit } - p.SetState(2010) + p.SetState(2015) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserCOMMA { { - p.SetState(2009) + p.SetState(2014) p.Default_DEFAULT__value() } } { - p.SetState(2012) + p.SetState(2017) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2013) + p.SetState(2018) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2014) + p.SetState(2019) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2016) + p.SetState(2021) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(2015) + p.SetState(2020) p.Partition_by() } } { - p.SetState(2018) + p.SetState(2023) p.Order_by_expr_asc_desc() } { - p.SetState(2019) + p.SetState(2024) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNTH_VALUE_: p.EnterOuterAlt(localctx, 5) { - p.SetState(2021) + p.SetState(2026) p.Match(SQLiteParserNTH_VALUE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2022) + p.SetState(2027) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2023) + p.SetState(2028) p.expr(0) } { - p.SetState(2024) + p.SetState(2029) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2025) + p.SetState(2030) p.Signed_number() } { - p.SetState(2026) + p.SetState(2031) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2027) + p.SetState(2032) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2028) + p.SetState(2033) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2030) + p.SetState(2035) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(2029) + p.SetState(2034) p.Partition_by() } } { - p.SetState(2032) + p.SetState(2037) p.Order_by_expr_asc_desc() } - p.SetState(2034) + p.SetState(2039) 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(2033) + p.SetState(2038) p.Frame_clause() } } { - p.SetState(2036) + p.SetState(2041) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserNTILE_: p.EnterOuterAlt(localctx, 6) { - p.SetState(2038) + p.SetState(2043) p.Match(SQLiteParserNTILE_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2039) + p.SetState(2044) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2040) + p.SetState(2045) p.expr(0) } { - p.SetState(2041) + p.SetState(2046) p.Match(SQLiteParserCLOSE_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2042) + p.SetState(2047) p.Match(SQLiteParserOVER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2043) + p.SetState(2048) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2045) + p.SetState(2050) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserPARTITION_ { { - p.SetState(2044) + p.SetState(2049) p.Partition_by() } } { - p.SetState(2047) + p.SetState(2052) p.Order_by_expr_asc_desc() } { - p.SetState(2048) + p.SetState(2053) 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. @@ -24617,23 +27605,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 @@ -24684,39 +27677,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(2052) + p.SetState(2057) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2053) + p.SetState(2058) 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. @@ -24735,23 +27722,28 @@ 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 +} + 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 @@ -24802,39 +27794,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(2055) + p.SetState(2060) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2056) + p.SetState(2061) 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. @@ -24855,23 +27841,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 @@ -24951,60 +27942,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(2058) + p.SetState(2063) p.Match(SQLiteParserPARTITION_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2059) + p.SetState(2064) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2061) + p.SetState(2066) 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(2060) + p.SetState(2065) 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(2063) + p.SetState(2068) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 306, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 306, 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. @@ -25025,23 +28021,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 @@ -25121,54 +28122,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(2065) + p.SetState(2070) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2066) + p.SetState(2071) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } - p.SetState(2068) + p.SetState(2073) 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(2067) + p.SetState(2072) p.expr(0) } - p.SetState(2070) + p.SetState(2075) 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. @@ -25188,23 +28194,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 @@ -25259,43 +28270,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(2072) + p.SetState(2077) p.Match(SQLiteParserORDER_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2073) + p.SetState(2078) p.Match(SQLiteParserBY_) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2074) + p.SetState(2079) 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. @@ -25318,23 +28327,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 @@ -25455,76 +28469,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(2076) + p.SetState(2081) p.expr(0) } - p.SetState(2078) + p.SetState(2083) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { { - p.SetState(2077) + p.SetState(2082) p.Asc_desc() } } - p.SetState(2087) + p.SetState(2092) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) for _la == SQLiteParserCOMMA { { - p.SetState(2080) + p.SetState(2085) p.Match(SQLiteParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2081) + p.SetState(2086) p.expr(0) } - p.SetState(2083) + p.SetState(2088) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } _la = p.GetTokenStream().LA(1) if _la == SQLiteParserASC_ || _la == SQLiteParserDESC_ { { - p.SetState(2082) + p.SetState(2087) p.Asc_desc() } } - p.SetState(2089) + p.SetState(2094) 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. @@ -25542,23 +28563,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 @@ -25605,35 +28631,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(2090) + 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 } // IRecursive__selectContext is an interface to support dynamic dispatch. @@ -25651,23 +28667,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 @@ -25714,35 +28735,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(2092) + p.SetState(2097) 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. @@ -25763,23 +28774,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 @@ -25826,35 +28842,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(2094) + p.SetState(2099) _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) @@ -25862,7 +28859,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. @@ -25880,23 +28887,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 @@ -25931,35 +28943,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(2096) + p.SetState(2101) 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. @@ -25978,23 +28984,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 @@ -26057,48 +29068,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(2100) + p.SetState(2105) 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(), 311, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) { - p.SetState(2098) + p.SetState(2103) p.expr(0) } case 2: p.EnterOuterAlt(localctx, 2) { - p.SetState(2099) + p.SetState(2104) 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. @@ -26117,23 +29124,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 @@ -26172,32 +29184,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(2102) + p.SetState(2107) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL) { @@ -26208,7 +29201,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. @@ -26382,23 +29385,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 @@ -27057,35 +30065,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(2104) + p.SetState(2109) _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) @@ -27093,7 +30082,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. @@ -27111,23 +30110,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 @@ -27174,35 +30178,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(2106) + 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 } // IFunction_nameContext is an interface to support dynamic dispatch. @@ -27220,23 +30214,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 @@ -27283,35 +30282,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(2108) + p.SetState(2113) 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. @@ -27331,23 +30320,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 @@ -27414,49 +30408,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(2113) + p.SetState(2118) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 312, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 312, p.GetParserRuleContext()) == 1 { { - p.SetState(2110) + p.SetState(2115) p.Schema_name() } { - p.SetState(2111) + p.SetState(2116) p.Match(SQLiteParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } + } else if p.HasError() { // JIM + goto errorExit } { - p.SetState(2115) + p.SetState(2120) 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. @@ -27474,23 +30464,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 @@ -27537,35 +30532,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(2117) + 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_nameContext is an interface to support dynamic dispatch. @@ -27583,23 +30568,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 @@ -27646,35 +30636,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(2119) + 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 } // ITable_or_index_nameContext is an interface to support dynamic dispatch. @@ -27692,23 +30672,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 @@ -27755,35 +30740,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(2121) + 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 } // INew_table_nameContext is an interface to support dynamic dispatch. @@ -27801,23 +30776,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 @@ -27864,35 +30844,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) - } - } - }() - + localctx = NewNew_table_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 188, SQLiteParserRULE_new_table_name) p.EnterOuterAlt(localctx, 1) { - p.SetState(2123) + 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 } // IColumn_nameContext is an interface to support dynamic dispatch. @@ -27910,23 +30880,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 @@ -27973,35 +30948,25 @@ func (s *Column_nameContext) ExitRule(listener antlr.ParseTreeListener) { } 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) - } - } - }() - p.EnterOuterAlt(localctx, 1) { - p.SetState(2125) + 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 } // ICollation_nameContext is an interface to support dynamic dispatch. @@ -28019,23 +30984,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 @@ -28082,35 +31052,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(2127) + 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 } // IForeign_tableContext is an interface to support dynamic dispatch. @@ -28128,23 +31088,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 @@ -28191,35 +31156,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(2129) + 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 } // IIndex_nameContext is an interface to support dynamic dispatch. @@ -28237,23 +31192,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 @@ -28300,35 +31260,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(2131) + 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 } // ITrigger_nameContext is an interface to support dynamic dispatch. @@ -28346,23 +31296,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 @@ -28409,35 +31364,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(2133) + 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 } // IView_nameContext is an interface to support dynamic dispatch. @@ -28455,23 +31400,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 @@ -28518,35 +31468,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(2135) + 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 } // IModule_nameContext is an interface to support dynamic dispatch. @@ -28564,23 +31504,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 @@ -28627,35 +31572,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(2137) + 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 } // IPragma_nameContext is an interface to support dynamic dispatch. @@ -28673,23 +31608,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 @@ -28736,35 +31676,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(2139) + 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 } // ISavepoint_nameContext is an interface to support dynamic dispatch. @@ -28782,23 +31712,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 @@ -28845,35 +31780,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(2141) + p.SetState(2146) 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. @@ -28892,23 +31817,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 @@ -28947,32 +31877,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(2143) + p.SetState(2148) _la = p.GetTokenStream().LA(1) if !(_la == SQLiteParserIDENTIFIER || _la == SQLiteParserSTRING_LITERAL) { @@ -28983,7 +31894,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. @@ -29001,23 +31922,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 @@ -29064,35 +31990,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(2145) + 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 } // ITransaction_nameContext is an interface to support dynamic dispatch. @@ -29110,23 +32026,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 @@ -29173,35 +32094,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(2147) + 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 } // IWindow_nameContext is an interface to support dynamic dispatch. @@ -29219,23 +32130,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 @@ -29282,35 +32198,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(2149) + 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 } // IAliasContext is an interface to support dynamic dispatch. @@ -29328,23 +32234,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 @@ -29391,35 +32302,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(2151) + 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 } // IFilenameContext is an interface to support dynamic dispatch. @@ -29437,23 +32338,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 @@ -29500,35 +32406,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(2153) + 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 } // IBase_window_nameContext is an interface to support dynamic dispatch. @@ -29546,23 +32442,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 @@ -29609,35 +32510,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(2155) + 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 } // ISimple_funcContext is an interface to support dynamic dispatch. @@ -29655,23 +32546,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 @@ -29718,35 +32614,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(2157) + 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 } // IAggregate_funcContext is an interface to support dynamic dispatch. @@ -29764,23 +32650,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 @@ -29827,35 +32718,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(2159) + 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 } // ITable_function_nameContext is an interface to support dynamic dispatch. @@ -29873,23 +32754,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 @@ -29936,35 +32822,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(2161) + p.SetState(2166) 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. @@ -29987,23 +32863,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 @@ -30082,73 +32963,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(2170) + p.SetState(2175) p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } switch p.GetTokenStream().LA(1) { case SQLiteParserIDENTIFIER: p.EnterOuterAlt(localctx, 1) { - p.SetState(2163) + p.SetState(2168) 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(2164) + p.SetState(2169) p.Keyword() } case SQLiteParserSTRING_LITERAL: p.EnterOuterAlt(localctx, 3) { - p.SetState(2165) + p.SetState(2170) p.Match(SQLiteParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } case SQLiteParserOPEN_PAR: p.EnterOuterAlt(localctx, 4) { - p.SetState(2166) + p.SetState(2171) p.Match(SQLiteParserOPEN_PAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } { - p.SetState(2167) + p.SetState(2172) p.Any_name() } { - p.SetState(2168) + p.SetState(2173) 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 { @@ -30166,47 +33057,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 dc39a15fd8..b5720dbc33 100644 --- a/internal/ext/process/gen.go +++ b/internal/ext/process/gen.go @@ -5,34 +5,70 @@ import ( "context" "errors" "fmt" + "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 + 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))) } out, err := cmd.Output() @@ -42,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 ab273e6ae2..0000000000 --- a/internal/ext/wasm/nowasm.go +++ /dev/null @@ -1,19 +0,0 @@ -//go:build nowasm || !(cgo && ((linux && amd64) || (linux && arm64) || (darwin && amd64) || (darwin && arm64) || (windows && amd64))) - -package wasm - -import ( - "fmt" - "context" - - "github.com/sqlc-dev/sqlc/internal/plugin" -) - -type Runner struct { - URL string - SHA256 string -} - -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/runner.go b/internal/ext/wasm/runner.go new file mode 100644 index 0000000000..352d827f9f --- /dev/null +++ b/internal/ext/wasm/runner.go @@ -0,0 +1,7 @@ +package wasm + +type Runner struct { + URL string + SHA256 string + Env []string +} diff --git a/internal/ext/wasm/wasm.go b/internal/ext/wasm/wasm.go index 7b1e756e8b..58384a9c95 100644 --- a/internal/ext/wasm/wasm.go +++ b/internal/ext/wasm/wasm.go @@ -1,182 +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/v8" + "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 = `v8.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 -} - -type Runner struct { - URL string - SHA256 string -} - 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 + return "", err } - data, ok := value.([]byte) - if !ok { - return nil, fmt.Errorf("returned value was not a byte slice") - } - 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) } @@ -191,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 } @@ -215,97 +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 +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") } - engine := wasmtime.NewEngine() - module, err := r.loadModule(ctx, engine) - if err != nil { - return nil, fmt.Errorf("loadModule: %w", 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 } - linker := wasmtime.NewLinker(engine) - if err := linker.DefineWasi(); err != nil { - return nil, err + stdinBlob, err := proto.Marshal(req) + if err != nil { + return fmt.Errorf("failed to encode codegen request: %w", err) } - dir, err := os.MkdirTemp(os.Getenv("SQLCTMPDIR"), "out") + runtimeAndCode, err := r.loadAndCompile(ctx) if err != nil { - return nil, fmt.Errorf("temp dir: %w", err) + return fmt.Errorf("loadBytes: %w", err) } - defer os.RemoveAll(dir) - stdinPath := filepath.Join(dir, "stdin") - stderrPath := filepath.Join(dir, "stderr") - stdoutPath := filepath.Join(dir, "stdout") + var stderr, stdout bytes.Buffer - if err := os.WriteFile(stdinPath, stdinBlob, 0755); err != nil { - return nil, fmt.Errorf("write file: %w", err) + 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 { + conf = conf.WithEnv(key, os.Getenv(key)) } - // Configure WASI imports to write stdout into a file. - wasiConfig := wasmtime.NewWasiConfig() - wasiConfig.SetStdinFile(stdinPath) - wasiConfig.SetStdoutFile(stdoutPath) - wasiConfig.SetStderrFile(stderrPath) - - 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 36af07d482..8ec3ad2964 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.20.0" +const Version = "v1.29.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 b735e90357..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,430 +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"` - 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) GetOutputFilesSuffix() string { - if x != nil { - return x.OutputFilesSuffix - } - return "" -} - -func (x *GoCode) GetEmitEnumValidMethod() bool { - if x != nil { - return x.EmitEnumValidMethod - } - return false -} - -func (x *GoCode) GetEmitAllEnumValues() bool { - if x != nil { - return x.EmitAllEnumValues + } + return ms } - return false + return mi.MessageOf(x) } -func (x *GoCode) GetInflectionExcludeTableNames() []string { - if x != nil { - return x.InflectionExcludeTableNames - } - return nil +// Deprecated: Use Settings.ProtoReflect.Descriptor instead. +func (*Settings) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{1} } -func (x *GoCode) GetEmitPointersForNullTypes() bool { +func (x *Settings) GetVersion() string { if x != nil { - return x.EmitPointersForNullTypes + return x.Version } - return false + return "" } -func (x *GoCode) GetQueryParameterLimit() int32 { - if x != nil && x.QueryParameterLimit != nil { - return *x.QueryParameterLimit +func (x *Settings) GetEngine() string { + if x != nil { + 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 { @@ -729,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 { @@ -769,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) } @@ -782,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 { @@ -795,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 { @@ -841,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) } @@ -854,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 { @@ -867,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 { @@ -917,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) } @@ -930,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 { @@ -943,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 { @@ -973,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) } @@ -986,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 { @@ -999,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 { @@ -1036,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) } @@ -1049,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 { @@ -1062,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 { @@ -1099,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) } @@ -1112,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 { @@ -1125,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 { @@ -1176,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) } @@ -1189,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 { @@ -1202,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 { @@ -1335,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) } @@ -1348,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 { @@ -1361,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 { @@ -1432,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) } @@ -1445,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 { @@ -1458,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 { @@ -1475,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 @@ -1485,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 { @@ -1514,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 @@ -1562,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 { @@ -1589,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{ @@ -1609,284 +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, - 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, 0xc4, 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, 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, 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, + 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, - 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, + 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, 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, + 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, 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 ( @@ -1901,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() } @@ -1976,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: @@ -1988,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: @@ -2000,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: @@ -2012,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: @@ -2024,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: @@ -2036,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: @@ -2048,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: @@ -2060,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: @@ -2072,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: @@ -2084,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: @@ -2096,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: @@ -2108,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: @@ -2120,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: @@ -2132,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: @@ -2144,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: @@ -2180,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 e40d858d06..0000000000 --- a/internal/plugin/codegen_vtproto.pb.go +++ /dev/null @@ -1,9552 +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, - 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 - } - 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 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 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 - } - 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) - 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/rpc.go b/internal/quickdb/rpc.go new file mode 100644 index 0000000000..9d9649d3dc --- /dev/null +++ b/internal/quickdb/rpc.go @@ -0,0 +1,57 @@ +package quickdb + +import ( + "crypto/tls" + + "github.com/riza-io/grpc-go/credentials/basic" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + + "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 + return NewClient(projectID, cloudConfig.AuthToken, WithHost(cloudConfig.Hostname)) +} + +type options struct { + hostname string +} + +type Option func(*options) + +func WithHost(host string) Option { + return func(o *options) { + o.hostname = host + } +} + +func NewClient(project, token string, opts ...Option) (pb.QuickClient, error) { + var o options + for _, apply := range opts { + apply(&o) + } + + dialOpts := []grpc.DialOption{ + grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), + grpc.WithPerRPCCredentials(basic.NewPerRPCCredentials(project, token)), + grpc.WithUnaryInterceptor(rpc.UnaryInterceptor), + } + + hostname := o.hostname + if hostname == "" { + hostname = defaultHostname + } + + conn, err := grpc.Dial(hostname+":443", dialOpts...) + if err != nil { + return nil, err + } + + return pb.NewQuickClient(conn), nil +} diff --git a/internal/quickdb/v1/quickdb.pb.go b/internal/quickdb/v1/quickdb.pb.go new file mode 100755 index 0000000000..690dfc16f1 --- /dev/null +++ b/internal/quickdb/v1/quickdb.pb.go @@ -0,0 +1,1142 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc (unknown) +// source: v1/quickdb.proto + +package quickdbv1 + +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 CreateEphemeralDatabaseRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + ServerId string `protobuf:"bytes,3,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + Migrations []string `protobuf:"bytes,4,rep,name=migrations,proto3" json:"migrations,omitempty"` +} + +func (x *CreateEphemeralDatabaseRequest) Reset() { + *x = CreateEphemeralDatabaseRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateEphemeralDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateEphemeralDatabaseRequest) ProtoMessage() {} + +func (x *CreateEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 CreateEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. +func (*CreateEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateEphemeralDatabaseRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *CreateEphemeralDatabaseRequest) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *CreateEphemeralDatabaseRequest) GetServerId() string { + if x != nil { + return x.ServerId + } + return "" +} + +func (x *CreateEphemeralDatabaseRequest) GetMigrations() []string { + if x != nil { + return x.Migrations + } + return nil +} + +type CreateEphemeralDatabaseResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + Uri string `protobuf:"bytes,2,opt,name=uri,proto3" json:"uri,omitempty"` +} + +func (x *CreateEphemeralDatabaseResponse) Reset() { + *x = CreateEphemeralDatabaseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateEphemeralDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateEphemeralDatabaseResponse) ProtoMessage() {} + +func (x *CreateEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 CreateEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. +func (*CreateEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateEphemeralDatabaseResponse) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +func (x *CreateEphemeralDatabaseResponse) GetUri() string { + if x != nil { + return x.Uri + } + return "" +} + +type DropEphemeralDatabaseRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` +} + +func (x *DropEphemeralDatabaseRequest) Reset() { + *x = DropEphemeralDatabaseRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DropEphemeralDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DropEphemeralDatabaseRequest) ProtoMessage() {} + +func (x *DropEphemeralDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 DropEphemeralDatabaseRequest.ProtoReflect.Descriptor instead. +func (*DropEphemeralDatabaseRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{2} +} + +func (x *DropEphemeralDatabaseRequest) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +type DropEphemeralDatabaseResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DropEphemeralDatabaseResponse) Reset() { + *x = DropEphemeralDatabaseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DropEphemeralDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DropEphemeralDatabaseResponse) ProtoMessage() {} + +func (x *DropEphemeralDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 DropEphemeralDatabaseResponse.ProtoReflect.Descriptor instead. +func (*DropEphemeralDatabaseResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{3} +} + +type File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3" json:"contents,omitempty"` +} + +func (x *File) Reset() { + *x = File{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*File) ProtoMessage() {} + +func (x *File) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_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 File.ProtoReflect.Descriptor instead. +func (*File) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{4} +} + +func (x *File) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *File) GetContents() []byte { + if x != nil { + return x.Contents + } + 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"` // 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_v1_quickdb_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadArchiveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadArchiveRequest) ProtoMessage() {} + +func (x *UploadArchiveRequest) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[6] + 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 UploadArchiveRequest.ProtoReflect.Descriptor instead. +func (*UploadArchiveRequest) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{6} +} + +func (x *UploadArchiveRequest) GetSqlcVersion() string { + if x != nil { + return x.SqlcVersion + } + return "" +} + +func (x *UploadArchiveRequest) GetInputs() []*File { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *UploadArchiveRequest) GetOutputs() []*File { + if x != nil { + return x.Outputs + } + 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 + unknownFields protoimpl.UnknownFields + + Checksum []byte `protobuf:"bytes,1,opt,name=checksum,proto3" json:"checksum,omitempty"` +} + +func (x *UploadArchiveResponse) Reset() { + *x = UploadArchiveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_v1_quickdb_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadArchiveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadArchiveResponse) ProtoMessage() {} + +func (x *UploadArchiveResponse) ProtoReflect() protoreflect.Message { + mi := &file_v1_quickdb_proto_msgTypes[7] + 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 UploadArchiveResponse.ProtoReflect.Descriptor instead. +func (*UploadArchiveResponse) Descriptor() ([]byte, []int) { + return file_v1_quickdb_proto_rawDescGZIP(), []int{7} +} + +func (x *UploadArchiveResponse) GetChecksum() []byte { + if x != nil { + return x.Checksum + } + return nil +} + +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, + 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, 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, + 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_v1_quickdb_proto_rawDescOnce sync.Once + file_v1_quickdb_proto_rawDescData = file_v1_quickdb_proto_rawDesc +) + +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_v1_quickdb_proto_rawDescData +} + +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 + (*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_v1_quickdb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateEphemeralDatabaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateEphemeralDatabaseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DropEphemeralDatabaseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DropEphemeralDatabaseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + 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 + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_v1_quickdb_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadArchiveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + 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_v1_quickdb_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_v1_quickdb_proto_goTypes, + DependencyIndexes: file_v1_quickdb_proto_depIdxs, + MessageInfos: file_v1_quickdb_proto_msgTypes, + }.Build() + 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 9a6ed077d3..8b88a24136 100644 --- a/internal/source/code.go +++ b/internal/source/code.go @@ -12,6 +12,13 @@ type Edit struct { Location int Old string New string + OldFunc func(string) int +} + +type CommentSyntax struct { + Dash bool + Hash bool + SlashStar bool } func LineNumber(source string, head int) (int, int) { @@ -63,8 +70,14 @@ func Mutate(raw string, a []Edit) (string, error) { if start > len(s) || start < 0 { return "", fmt.Errorf("edit start location is out of bounds") } + var oldLen int + if edit.OldFunc != nil { + oldLen = edit.OldFunc(s[start:]) + } else { + oldLen = len(edit.Old) + } - stop := edit.Location + len(edit.Old) + stop := edit.Location + oldLen if stop > len(s) { return "", fmt.Errorf("edit stop location is out of bounds") } @@ -73,7 +86,7 @@ func Mutate(raw string, a []Edit) (string, error) { // this edit overlaps the previous one (and is therefore a developer error) if idx != 0 { prevEdit := a[idx-1] - if prevEdit.Location < edit.Location+len(edit.Old) { + if prevEdit.Location < edit.Location+oldLen { return "", fmt.Errorf("2 edits overlap") } } @@ -94,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 @@ -104,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/bool_expr_type.go b/internal/sql/ast/bool_expr_type.go index 0296a9691d..7a4068d102 100644 --- a/internal/sql/ast/bool_expr_type.go +++ b/internal/sql/ast/bool_expr_type.go @@ -6,6 +6,10 @@ const ( BoolExprTypeAnd BoolExprTypeOr BoolExprTypeNot + + // Added for MySQL + BoolExprTypeIsNull + BoolExprTypeIsNotNull ) type BoolExprType uint 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/sort_by_dir.go b/internal/sql/ast/sort_by_dir.go index f7f8d53950..3ebd212a79 100644 --- a/internal/sql/ast/sort_by_dir.go +++ b/internal/sql/ast/sort_by_dir.go @@ -5,3 +5,11 @@ type SortByDir uint func (n *SortByDir) Pos() int { return 0 } + +const ( + SortByDirUndefined SortByDir = 0 + SortByDirDefault SortByDir = 1 + SortByDirAsc SortByDir = 2 + SortByDirDesc SortByDir = 3 + SortByDirUsing SortByDir = 4 +) diff --git a/internal/sql/ast/sort_by_nulls.go b/internal/sql/ast/sort_by_nulls.go index c4d67c5d7f..512b5a14e1 100644 --- a/internal/sql/ast/sort_by_nulls.go +++ b/internal/sql/ast/sort_by_nulls.go @@ -5,3 +5,10 @@ type SortByNulls uint func (n *SortByNulls) Pos() int { return 0 } + +const ( + SortByNullsUndefined SortByNulls = 0 + SortByNullsDefault SortByNulls = 1 + SortByNullsFirst SortByNulls = 2 + SortByNullsLast SortByNulls = 3 +) 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/astutils/walk.go b/internal/sql/astutils/walk.go index 9f26617ad3..0943379f03 100644 --- a/internal/sql/astutils/walk.go +++ b/internal/sql/astutils/walk.go @@ -2158,10 +2158,8 @@ func Walk(f Visitor, node ast.Node) { } case *ast.In: - if n.List != nil { - for _, l := range n.List { - Walk(f, l) - } + for _, l := range n.List { + Walk(f, l) } if n.Sel != nil { Walk(f, n.Sel) 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 9d903bd297..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,15 +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, - 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 } @@ -75,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 } @@ -120,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. @@ -186,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: @@ -194,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: @@ -267,7 +277,7 @@ func (c *Catalog) createTable(stmt *ast.CreateTableStmt) error { seen[col.Name] = notNull || col.IsNotNull if a, ok := coltype[col.Name]; ok { if !sameType(&a, &col.Type) { - return fmt.Errorf("column \"%s\" has a type conflict", col.Name) + return fmt.Errorf("column %q has a type conflict", col.Name) } } continue @@ -279,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 { @@ -292,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 \"%s\" 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 @@ -339,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 @@ -352,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 @@ -382,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 } @@ -396,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/sqlerr/errors.go b/internal/sql/sqlerr/errors.go index 13c38ef1ae..c9cf58dfa0 100644 --- a/internal/sql/sqlerr/errors.go +++ b/internal/sql/sqlerr/errors.go @@ -35,7 +35,7 @@ func ColumnExists(rel, col string) *Error { return &Error{ Err: Exists, Code: "42701", - Message: fmt.Sprintf("column \"%s\" of relation \"%s\"", col, rel), + Message: fmt.Sprintf("column %q of relation %q", col, rel), } } @@ -43,7 +43,7 @@ func ColumnNotFound(rel, col string) *Error { return &Error{ Err: NotFound, Code: "42703", - Message: fmt.Sprintf("column \"%s\" of relation \"%s\"", col, rel), + Message: fmt.Sprintf("column %q of relation %q", col, rel), } } @@ -51,7 +51,7 @@ func RelationExists(rel string) *Error { return &Error{ Err: Exists, Code: "42P07", - Message: fmt.Sprintf("relation \"%s\"", rel), + Message: fmt.Sprintf("relation %q", rel), } } @@ -59,7 +59,7 @@ func RelationNotFound(rel string) *Error { return &Error{ Err: NotFound, Code: "42P01", - Message: fmt.Sprintf("relation \"%s\"", rel), + Message: fmt.Sprintf("relation %q", rel), } } @@ -67,7 +67,7 @@ func SchemaExists(name string) *Error { return &Error{ Err: Exists, Code: "42P06", - Message: fmt.Sprintf("schema \"%s\"", name), + Message: fmt.Sprintf("schema %q", name), } } @@ -75,7 +75,7 @@ func SchemaNotFound(sch string) *Error { return &Error{ Err: NotFound, Code: "3F000", - Message: fmt.Sprintf("schema \"%s\"", sch), + Message: fmt.Sprintf("schema %q", sch), } } @@ -83,7 +83,7 @@ func TypeExists(typ string) *Error { return &Error{ Err: Exists, Code: "42710", - Message: fmt.Sprintf("type \"%s\"", typ), + Message: fmt.Sprintf("type %q", typ), } } @@ -91,7 +91,7 @@ func TypeNotFound(typ string) *Error { return &Error{ Err: NotFound, Code: "42704", - Message: fmt.Sprintf("type \"%s\"", typ), + Message: fmt.Sprintf("type %q", typ), } } @@ -99,13 +99,13 @@ func FunctionNotFound(fun string) *Error { return &Error{ Err: NotFound, Code: "42704", - Message: fmt.Sprintf("function \"%s\"", fun), + Message: fmt.Sprintf("function %q", fun), } } func FunctionNotUnique(fn string) *Error { return &Error{ Err: NotUnique, - Message: fmt.Sprintf("function name \"%s\"", fn), + Message: fmt.Sprintf("function name %q", fn), } } 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/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..9c068a39ba --- /dev/null +++ b/internal/sqltest/local/mysql.go @@ -0,0 +1,96 @@ +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" +) + +var mysqlSync sync.Once +var mysqlPool *sql.DB + +func MySQLServer() string { + return os.Getenv("MYSQL_SERVER_URI") +} + +func MySQL(t *testing.T, migrations []string) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("MYSQL_SERVER_URI") + if dburi == "" { + 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..7b2c16c40a --- /dev/null +++ b/internal/sqltest/local/postgres.go @@ -0,0 +1,123 @@ +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" +) + +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 PostgreSQLServer() string { + return os.Getenv("POSTGRESQL_SERVER_URI") +} + +func postgreSQL(t *testing.T, migrations []string, rw bool) string { + ctx := context.Background() + t.Helper() + + dburi := os.Getenv("POSTGRESQL_SERVER_URI") + if dburi == "" { + 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/internal/tools/sqlc-pg-gen/main.go b/internal/tools/sqlc-pg-gen/main.go index cba3b36492..d70dcb9595 100644 --- a/internal/tools/sqlc-pg-gen/main.go +++ b/internal/tools/sqlc-pg-gen/main.go @@ -13,7 +13,7 @@ import ( "strings" "text/template" - pgx "github.com/jackc/pgx/v4" + "github.com/jackc/pgx/v4" ) // https://dba.stackexchange.com/questions/255412/how-to-select-functions-that-belong-in-a-given-extension-in-postgresql @@ -308,8 +308,7 @@ func run(ctx context.Context) error { funcName += strings.Title(part) } - _, err := conn.Exec(ctx, fmt.Sprintf("CREATE EXTENSION IF NOT EXISTS \"%s\"", extension)) - if err != nil { + if _, err := conn.Exec(ctx, fmt.Sprintf("CREATE EXTENSION IF NOT EXISTS %q", extension)); err != nil { return fmt.Errorf("error creating %s: %s", extension, err) } 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 d9289383f9..e6faf19bad 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -2,105 +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_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 { @@ -178,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 3e7b83f366..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,11 +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) - if realmode { - if err := os.WriteFile(path, []byte(new), 0644); err != nil { - return fmt.Errorf("write error: %s: %w", path, err) - } + new = strings.ReplaceAll(new, "SQLC_VERSION=v"+current, "SQLC_VERSION=v"+next) + if err := write(path, old, new); err != nil { + return err } default: } @@ -134,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 07b3ce46a0..0000000000 --- a/scripts/regenerate/main.go +++ /dev/null @@ -1,84 +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", "--experimental") - 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()}}}) +}