From 55cdfcae791c2c73fbe47c8d6b64fc8cab294b40 Mon Sep 17 00:00:00 2001 From: zenpk <99558412+zenpk@users.noreply.github.com> Date: Sun, 7 Jul 2024 21:40:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20doc:=20add=20how=20to=20use=20cu?= =?UTF-8?q?stom=20filters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ _examples/httpdemo2/main.go | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d160c1..89ce049 100644 --- a/README.md +++ b/README.md @@ -627,6 +627,8 @@ func main() { return 1, nil }, }) + // use the added filter + v.FilterRule("field", "myToIntFilter0") } ``` diff --git a/_examples/httpdemo2/main.go b/_examples/httpdemo2/main.go index 318e0da..8571dd7 100644 --- a/_examples/httpdemo2/main.go +++ b/_examples/httpdemo2/main.go @@ -40,8 +40,7 @@ func main() { v := data.Create() // setting rules v. - // StringRule("categoryId", "required|int|min:1", "newIsInt"). - StringRule("categoryId", "required|int|min:1", "toInt"). + StringRule("categoryId", "required|int|min:1", "newIsInt"). AddMessages(map[string]string{ "required": "the {field} is required", "min": "{field} min value is %d",