- Notifications
You must be signed in to change notification settings - Fork 978
Closed
Labels
Description
Version
1.13.0
What happened?
When creating an insert query for a json column, sqlc does not generate the column name in the golang struct if I try to add CAST(CONVERT( ? USING utf8) AS JSON)
From playing around with MySql and Postgres in the playground, I've noticed that it works fine in Postgres but not when using MySql
Postgres playground:
https://play.sqlc.dev/p/ea800eff2a7beb25bc960f7d839ea96039b5dad0c46f16dddd97f76dc28d3388
MySql playground:
https://play.sqlc.dev/p/38ec6bf15657aa79f4a3dd7c72c559934038a591625869b2dfe59a87498f7b1f
Relevant log output
No response
Database schema
CREATETABLEproduct_versions ( id INTNOT NULL AUTO_INCREMENT PRIMARY KEY, product_id INTNOT NULL, product_key VARCHAR(255) NOT NULL UNIQUE, version INTNOT NULL, type ENUM ('LARGE', 'MEDIUM', 'SMALL') NOT NULL, status ENUM ('ACTIVE', 'DRAFT') NOT NULL, attributes JSON, created_at TIMESTAMPNOT NULL, created_by INTNOT NULL );SQL queries
-- name: CreateProductVersion :execresultINSERT INTO product_versions ( product_id, product_key, version, type, status, attributes, created_at, created_by ) VALUES ( ?, ?, ?, ?, ?, CAST(CONVERT( ? USING utf8) AS JSON), NOW(), ? );Configuration
version: "1"project: id: "project"packages: - name: "sqlc"path: "./sqlc"queries: "./sqlc/query/"schema: "./migrations"engine: "mysql"emit_json_tags: trueemit_interface: trueemit_exact_table_names: falsePlayground URL
https://play.sqlc.dev/p/ea7294bd54c9eae950221ae124b4685690c2e5328a9d6ae444bb1a455924c14e
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
adamjq, kheob and guadalupejazam