Skip to content

Validate generic struct inner values using existing tags even with private fields #1232

Answered by deankarn
Fire-Dragon-DoL asked this question in Q&A
Discussion options

You must be logged in to vote

@Fire-Dragon-DoL currently only custom validations, custom struct level validations or Registering a Custom type function to handle each individual type would be the only ways to handle that.

I am thinking about how to achieve this in a more generic way without the package needing to know each type beforehand to support my own similar Option generic struct.

I'm thinking about adding something similar to registering a custom type function but a custom interface function, the only issue is it's a very implicit thing to be doing which could cause unintended side-effects if anything else implements or changes to implement unknowingly the registered interface and so continuing to think about i…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@deankarn
Comment options

@Fire-Dragon-DoL
Comment options

@deankarn
Comment options

@Fire-Dragon-DoL
Comment options

@Fire-Dragon-DoL
Comment options

Answer selected by Fire-Dragon-DoL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants