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

home add context for binding validate #4170

Open
fanqingxuan opened this issue Mar 2, 2025 · 1 comment
Open

home add context for binding validate #4170

fanqingxuan opened this issue Mar 2, 2025 · 1 comment

Comments

@fanqingxuan
Copy link

because bind validator use the libaray of https://github.com/go-playground/validator, and user can add custom binding and validation by RegisterValidation, so user maybe query db、cache can some other component for their business,etc check unique from db, then need context parameter for query

bind valid interface original as

type StructValidator interface {
	ValidateStruct(any) error

hope as

type StructValidator interface {
	ValidateStruct(context.Context, any) error
@takanuva15
Copy link
Contributor

Hi, this is something you should raise in the https://github.com/go-playground/validator repo since they control the signature for validation, not gin. (I would like this feature too to enable more advanced validations for requests)

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

2 participants