Skip to content

execlastid doesn't respect support_big_numbers #22

Open
@yshrsmz

Description

@yshrsmz

related: #13, #15

export async function createAuthorReturnId(client: Client, args: CreateAuthorReturnIdArgs): Promise<number> {
const [result] = await client.query<ResultSetHeader>({
sql: createAuthorReturnIdQuery,
values: [args.name, args.bio]
});
return result?.insertId ?? 0;
}

This method should return string as support_big_numbers and big_number_strings is enabled in sqlc.dev.yml

- schema: "authors/mysql/schema.sql"
queries: "authors/mysql/query.sql"
engine: "mysql"
codegen:
- plugin: ts
out: node-mysql2/src/db
options:
runtime: node
driver: mysql2
mysql2:
big_number_strings: true
support_big_numbers: true

This is because I explicitly declared a return type as number here

https://github.com/sqlc-dev/sqlc-gen-typescript/pull/13/files#diff-2078b150759ca61c4ae2bb37cb070f5a2d81e64c7b4d1aa126f621e2520f13d0R641-R643

but should respect PK's type.

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