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 #1454

Closed
ahmed-envoy opened this issue Feb 23, 2022 · 2 comments
Closed

Kotlin generator doesn't work with named parameters #1454

ahmed-envoy opened this issue Feb 23, 2022 · 2 comments
Labels
📚 postgresql bug Something isn't working 💻 darwin wontfix This will not be worked on 🔧 kotlin

Comments

@ahmed-envoy
Copy link

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

@ahmed-envoy ahmed-envoy added bug Something isn't working triage New issues that hasn't been reviewed labels Feb 23, 2022
@kyleconroy kyleconroy added the wontfix This will not be worked on label Aug 29, 2022
@kyleconroy
Copy link
Collaborator

The Kotlin code generation currently doesn't support named parameters. Sadly Kotlin support isn't actively being worked on, so you'll need to continue to use positional parameters.

@kyleconroy kyleconroy removed the triage New issues that hasn't been reviewed label Aug 29, 2022
@kyleconroy
Copy link
Collaborator

Migrated to sqlc-dev/sqlc-gen-kotlin#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 postgresql bug Something isn't working 💻 darwin wontfix This will not be worked on 🔧 kotlin
Projects
None yet
Development

No branches or pull requests

2 participants