Skip to content

Commit 1174b88

Browse files
author
Dean Karn
authored
Merge pull request #38 from sakura1116vg/fix-indent-README.md
fix indent README.md
2 parents c78c4d6 + a04bd52 commit 1174b88

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Use go get.
5555
Then import the form package into your own code.
5656

5757
import "github.com/go-playground/form"
58-
58+
5959
Usage
6060
-----
6161

@@ -215,8 +215,8 @@ Registering Custom Types
215215
Decoder
216216
```go
217217
decoder.RegisterCustomTypeFunc(func(vals []string) (interface{}, error) {
218-
return time.Parse("2006-01-02", vals[0])
219-
}, time.Time{})
218+
return time.Parse("2006-01-02", vals[0])
219+
}, time.Time{})
220220
```
221221
ADDITIONAL: if a struct type is registered, the function will only be called if a url.Value exists for
222222
the struct and not just the struct fields eg. url.Values{"User":"Name%3Djoeybloggs"} will call the
@@ -226,16 +226,16 @@ custom type function with 'User' as the type, however url.Values{"User.Name":"jo
226226
Encoder
227227
```go
228228
encoder.RegisterCustomTypeFunc(func(x interface{}) ([]string, error) {
229-
return []string{x.(time.Time).Format("2006-01-02")}, nil
230-
}, time.Time{})
229+
return []string{x.(time.Time).Format("2006-01-02")}, nil
230+
}, time.Time{})
231231
```
232232

233233
Ignoring Fields
234234
--------------
235235
you can tell form to ignore fields using `-` in the tag
236236
```go
237237
type MyStruct struct {
238-
Field string `form:"-"`
238+
Field string `form:"-"`
239239
}
240240
```
241241

@@ -244,14 +244,14 @@ Omitempty
244244
you can tell form to omit empty fields using `,omitempty` or `FieldName,omitempty` in the tag
245245
```go
246246
type MyStruct struct {
247-
Field string `form:",omitempty"`
247+
Field string `form:",omitempty"`
248248
Field2 string `form:"CustomFieldName,omitempty"`
249249
}
250250
```
251251

252252
Notes
253253
------
254-
To maximize compatibility with other systems the Encoder attempts
254+
To maximize compatibility with other systems the Encoder attempts
255255
to avoid using array indexes in url.Values if at all possible.
256256

257257
eg.

0 commit comments

Comments
 (0)