Skip to content

Commit

Permalink
Add int format for bool type
Browse files Browse the repository at this point in the history
  • Loading branch information
sonh committed Oct 4, 2020
1 parent e36d44b commit 241468b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,21 @@ if err != nil {
}
fmt.Println(values.Encode()) //(unescaped) output: "from=2020-02-02T00:00:00Z&limit=24&tags=docker&tags=golang&tags=reactjs"
```
### Bool format
Use `int` option to encode bool to integer
```go
type Query struct {
DefaultFmt bool `qs:"default_fmt"`
IntFmt bool `qs:"int_fmt,int"`
}

querys := &Query{
DefaultFmt: true,
IntFmt: true,
}
values, _ := encoder.Values(querys)
fmt.Println(values.Encode()) // (unescaped) output: "default_fmt=true&int_fmt=1"
```
### Time format
By default, package encodes time.Time values as RFC3339 format.

Expand Down

0 comments on commit 241468b

Please sign in to comment.