Skip to content

Commit

Permalink
Added transformation & validation in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenQuim committed Feb 15, 2024
1 parent eb5163b commit 42bf98e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -50,6 +52,8 @@ func main() {
}
```

### Simple POST

```go
package main

Expand Down Expand Up @@ -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
}

```

<details>
<summary>All features</summary>

Expand Down

0 comments on commit 42bf98e

Please sign in to comment.