gookit / validate

⚔ Go package for data validation and filtering. support Map, Struct, Form data. Go通用的数据验证与过滤库,使用简单,内置大部分常用验证、过滤器,支持自定义验证器、自定义消息、字段翻译。
https://gookit.github.io/validate/
MIT License
1.08k stars 116 forks source link

[Doc] Add code example of how to use custom filters #268

Closed zenpk closed 4 months ago

zenpk commented 4 months ago

Description

Yesterday I tried to use a custom filter but couldn't get it to work. I looked in the documentation and example code but found no information about this, so I read the source code and figured out that I had to call the FilterRule method. Upon reflection, this design makes sense and feels natural but I think it would be good to have an example in the readme.

Changes Made

  1. Add a FilterRule call in the readme's Add Custom Filter section.
  2. Uncomment a line in the example code, making the usage of the custom filter more obvious.
coveralls commented 4 months ago

Pull Request Test Coverage Report for Build 9827826902

Details


Totals Coverage Status
Change from base Build 8995471607: 0.0%
Covered Lines: 2912
Relevant Lines: 3012

💛 - Coveralls