Closed
Description
Version
Other
What happened?
I'm using sqlc version 1.18.0. As the title suggests, the json_tags_case_style isn't functioning as expected when using sqlc.embed.
The following is the code generated when camel
is specified.
type HighScoreEmbedRow struct {
MiddleSchoolStudent MiddleSchoolStudent `json:"middleschoolstudent"`
HighScore int32 `json:"highScore"`
}
The expected value is middleSchoolStudent
, but it is still lowercase.
The following is the code generated when snake
is specified.
type HighScoreEmbedRow struct {
MiddleSchoolStudent MiddleSchoolStudent `json:"middleschoolstudent"`
HighScore int32 `json:"high_score"`
}
The value middle_school_student
should be generated as well, but it is lowercase.
Relevant log output
No response
Database schema
CREATE TABLE middle_school_students (
id bigserial PRIMARY KEY,
name text,
age integer
);
CREATE TABLE test_scores (
student_id bigint,
score integer,
grade text
);
SQL queries
-- name: HighScoreEmbed :many
WITH high_scores AS (
SELECT student_id, max(score) as high_score
FROM test_scores
GROUP BY 1
)
SELECT sqlc.embed(middle_school_students), high_score::integer
FROM middle_school_students
JOIN high_scores ON high_scores.student_id = middle_school_students.id;
Configuration
{
"version": "1",
"packages": [
{
"path": "db",
"engine": "postgresql",
"schema": "query.sql",
"queries": "query.sql",
"emit_json_tags": true,
"json_tags_case_style": "camel"
}
]
}
Playground URL
https://play.sqlc.dev/p/a05ea08c8c7dd6f427e6b0e399f4b2d753620f5370b39bafa915bb4fa7f41da7
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go