Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to distinguish func for different model in interface Method about DIY method #64

Closed
zhouyusd opened this issue Aug 27, 2021 · 2 comments
Assignees

Comments

@zhouyusd
Copy link
Contributor

Your Question

type Method interface {
    // select * from @@table where id=@id
    FindUserById(id int64) (gen.T, error)
}

g.ApplyInterface(
	func(method models.Method) {},
	g.GenerateModel("user"),
	g.GenerateModel("role"),
)

The document you expected this should be explained

I want the interface Method to apply only to user, but now it will generate two func FindUserById applied to user and role, respectively.

Expected answer

How to distinguish func for different model in interface Method

@tr1v3r
Copy link
Member

tr1v3r commented Aug 29, 2021

Sorry for not getting back to you sooner. Actually, if you don't want apply models.Method on table role, you can use ApplyBacic and it will not generate any methods.

g.ApplyBasic(g.GenerateModel("role"))
g.ApplyInterface(
	func(method models.Method) {},
	g.GenerateModel("user"),
)

@zhouyusd
Copy link
Contributor Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants