Skip to content

Kotlin generator doesn't work with named parameters #1

Open
@kyleconroy

Description

@kyleconroy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions