validator
validator copied to clipboard
default value
- [ ] I have looked at the documentation here first?
- [ ] I have looked at the examples provided that may showcase my question here?
Package version eg. v9, v10:
gin version:v1.7.7 validator: v10
Issue, Question or Enhancement:
How can i set a default to a field when it no passed?
Code sample, to showcase or reproduce:
type User struct {
FullName string `json:"FullName" binding:"(set a default value when FullName no passed)"`
}
Hey @linsijia1002. This package only does validation. Setting default value is not part of the library, but you can try out something like this. https://github.com/gin-gonic/gin/issues/1052#issuecomment-515966643