Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin generator doesn't work with named parameters #1

Open
kyleconroy opened this issue Nov 9, 2022 · 0 comments
Open

Kotlin generator doesn't work with named parameters #1

kyleconroy opened this issue Nov 9, 2022 · 0 comments

Comments

@kyleconroy
Copy link
Contributor

Version

1.12.0

What happened?

Tried to use named parameters with the Kotlin code generator, but ran into an error. I recreated the issue in the unit tests and came to know that Kotlin enforces the use of positional parameters with the Postgres engine.

Is it possible to get some guidance on which specific areas of the Kotlin code generator I should look at to add support for named parameters

Relevant log output

src/main/resources/authors/postgresql/query.sql:1:1: edited query syntax is invalid: syntax error at or near "dentifivation"
            src/main/resources/authors/postgresql/query.sql:10:1: edited query syntax is invalid: syntax error at or near "ame"
            src/main/resources/authors/postgresql/query.sql:18:1: edited query syntax is invalid: syntax error at or near "d"

Database schema

CREATE TABLE authors (
          id   BIGSERIAL PRIMARY KEY,
          name text      NOT NULL,
          bio  text
);

SQL queries

-- name: GetAuthor :one
SELECT * FROM authors
WHERE id = @identifivation LIMIT @lim;

-- name: ListAuthors :many
SELECT * FROM authors
ORDER BY name;

-- name: CreateAuthor :one
INSERT INTO authors (
          name, bio
) VALUES (
  @name, @bio
)
RETURNING *;

-- name: DeleteAuthor :exec
DELETE FROM authors
WHERE id = @id;

Configuration

{
  "version": "2",
  "sql": [
    {
      "schema": "postgresql/schema.sql",
      "queries": "postgresql/query.sql",
      "engine": "postgresql",
      "gen": {
        "go": {
          "package": "authors",
          "out": "postgresql"
        }
      }
    }
  ]
}

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Kotlin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant