-
Notifications
You must be signed in to change notification settings - Fork 968
Closed as not planned
Closed as not planned
Copy link
Labels
📚 mysql💻 darwin🔧 golangdocumentationImprovements or additions to documentationImprovements or additions to documentation
Description
Version
1.13.0
What happened?
sqlc generate creates a model in models.go like
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.13.0
type QuestionnaireResponseItem struct {
...
}
But given a query like
/* name: GetQuestionnaireResponseItemsByQuestionnaireResponseID :many */
SELECT
...
FROM
questionnaire_response_item
WHERE
questionnaire_response_id = ?
ORDER BY
id ASC;
It ignores the model in the model file, and generates a query function that looks like:
type GetQuestionnaireResponseItemsByQuestionnaireResponseIDRow struct {
...
}
func (q *Queries) GetQuestionnaireResponseItemsByQuestionnaireResponseID(ctx context.Context, questionnaireResponseID string) ([]GetQuestionnaireResponseItemsByQuestionnaireResponseIDRow, error) {
This return type should be QuestionnaireResponseItem from the models, instead it's GetQuestionnaireResponseItemsByQuestionnaireResponseIDRow generated as an inline struct.
The bodies of the struct in the models file and the struct in the query file are identical.
What would cause this behavior?
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
version: "1"
packages:
- name: "database"
path: "."
queries: "./queries.sql"
schema: "./migrations/"
engine: "mysql"
emit_json_tags: true
emit_prepared_queries: true
emit_interface: true
emit_exact_table_names: false
emit_empty_slices: falsePlayground URL
No response
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
📚 mysql💻 darwin🔧 golangdocumentationImprovements or additions to documentationImprovements or additions to documentation