Skip to content

Conversation

@jaronnie
Copy link
Contributor

@jaronnie jaronnie commented Dec 23, 2025

I want to add NoCache method for FindOne: FindOneNoCache and Nocache method for FindOneByXx: FindOneNoCacheByUsername. But interface-find-one.tpl does not render withCache value, also deleteMethod/findOneMethod/findOneByFieldExtraMethod/insertMethod/updateMethod tpl need this value.

interface-find-one.tpl:

FindOne(ctx context.Context, session sqlx.Session, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error)
{{ if .withCache }}FindOneNoCache(ctx context.Context, session sqlx.Session, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error){{end}}

@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…neByFieldExtraMethod/insertMethod/updateMethod tpl

feat(goctl): add withCache value for deleteMethod/findOneMethod/findOneByFieldExtraMethod/insertMethod/updateMethod tpl

feat(goctl): add withCache value for deleteMethod/findOneMethod/findOneByFieldExtraMethod/insertMethod/updateMethod tpl
@jaronnie
Copy link
Contributor Author

@kesonan

@jaronnie
Copy link
Contributor Author

@kevwan can you review?

@kesonan
Copy link
Collaborator

kesonan commented Jan 18, 2026

I think custom templates are a better solution. You can customize any function name you want.

@kesonan kesonan added the kind/need-more-discussion Not decided, need more discussion! label Jan 18, 2026
@jaronnie
Copy link
Contributor Author

When there is withCache, I can dynamically construct these functions based on whether the table has cache, and adding a withCache is also for the user to be to customize the template more flexibly.

@jaronnie
Copy link
Contributor Author

@kevwan This enhances the ability to customize templates; could you review the changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/need-more-discussion Not decided, need more discussion!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants