From 42bf98ec3f9e16227832024739726cebd6a6d407 Mon Sep 17 00:00:00 2001 From: EwenQuim Date: Wed, 14 Feb 2024 16:25:07 +0100 Subject: [PATCH] Added transformation & validation in readme --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index c23178d9..c6e9c71c 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ Chi, Gin, Fiber and Echo are great frameworks. But since they were designed a lo ## Examples +### Hello World + ```go package main @@ -50,6 +52,8 @@ func main() { } ``` +### Simple POST + ```go package main @@ -82,6 +86,25 @@ func main() { } ``` +### With transformation & custom validation + +```go +type MyInput struct { + Name string `json:"name" validate:"required"` +} + +func (r *MyInput) InTransform(context.Context) error { + r.Name = strings.ToLower(r.Name) + + if r.Name == "fuego" { + return errors.New("fuego is not a valid name for this input") + } + + return nil +} + +``` +
All features