Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feat: Allow Fixing Go Type in queries.sql#3346

Unanswered
Discussion options

I love sqlc, and can't say how much I appreciate the developers for creating it. Thank you.

However, I am starting to run an area where it is causing maintenance problems. Specifically with sqlc changing Go type names when I need to change a single table query into a multiple table query.

Consider if I have a query such as this:

-- name: LoadLink :oneSELECT*FROM link;

That will cause theLoadLink() method to return aLink type.

However, if I later need to add a JOIN to get field from a related table, that changes all related code toListFilteredLinksRow. Now I have to refactor and change all references fromLink toListFilteredLinksRow, which canresult in a large PR.

Is there any appetite to consider adding configuration to allow for more comments as sql-c specific directives to allow developer to specify the type name for a given query insidequery.sql?

-- name: LoadLink :one-- type: EnhancedLinkSELECT link.*,content.titleFROM linkJOIN contentONlink.id=content.link_id;

or this if you prefer(I like the former, but the latter would work too):

-- name: LoadLink :one, type: EnhancedLinkSELECT link.*,content.titleFROM linkJOIN contentONlink.id=content.link_id;

Would the sqlc team be open to a PR of this nature?

BTW, I really would not want this kind of info to be added tosqlc.yaml.

(Actually, I would prefer to see all DDL and DML-related settings to be inquery.sql orschema.sql vs.sqlc.yaml forlocalityofbehavior, but I digress.)

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
1 participant
@mikeschinkel

[8]ページ先頭

©2009-2025 Movatter.jp