Skip to content

Commit

Permalink
Update readme for adding tag example of binding time field (#1080)
Browse files Browse the repository at this point in the history
  • Loading branch information
yerstd authored and appleboy committed Aug 25, 2017
1 parent c25254f commit bc53884
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,12 @@ package main

import "log"
import "github.com/gin-gonic/gin"
import "time"

type Person struct {
Name string `form:"name"`
Address string `form:"address"`
Name string `form:"name"`
Address string `form:"address"`
Birthday time.Time `form:"birthday" time_format:"2006-01-02" time_utc:"1"`
}

func main() {
Expand All @@ -552,12 +554,18 @@ func startPage(c *gin.Context) {
if c.Bind(&person) == nil {
log.Println(person.Name)
log.Println(person.Address)
log.Println(person.Birthday)
}

c.String(200, "Success")
}
```

Test it with:
```sh
$ curl -X GET "localhost:8085/testing?name=appleboy&address=xyz&birthday=1992-03-15"
```

### Bind HTML checkboxes

See the [detail information](https://github.com/gin-gonic/gin/issues/129#issuecomment-124260092)
Expand Down

0 comments on commit bc53884

Please sign in to comment.