Commit Graph

27 Commits

Author SHA1 Message Date
Boyi Wu c16bfa7949 update for supporting file binding (#1264)
update for supporting multipart form and file binding 

example:
```
type PhoptUploadForm struct {
	imgData    *multipart.FileHeader `form:"img_data" binding:"required"`
	ProjectID   string `form:"project_id" binding:"required"`
	Description string `form:"description binding:"required"`
}
```


ref: https://github.com/gin-gonic/gin/issues/1263
2019-03-18 10:16:34 +08:00
Dmitry Kutakov 483f828bce add support arrays on mapping (#1797)
* add support arrays on mapping

* not allow default value on array mapping
2019-03-14 13:34:56 +08:00
田欧 a5dda62cdc
chore: use internal/json (#1791) 2019-03-05 06:46:18 +08:00
Dmitry Kutakov 805b2d4904 add support time.Duration on mapping (#1794) 2019-03-04 11:37:46 +08:00
Dmitry Kutakov 0d50ce8597 refactor(form_mapping.go): mapping ptr, struct and map (#1749)
* refactor(form_mapping.go): mapping ptr, struct and map

* fix #1672 correct work with ptr - not create value if field is not set
* avoid allocations on strings.Split() - change to strings.Index()
* fix #610 tag value "-" is mean ignoring field
* struct fields mapped like json.Unmarshal
* map fields mapped like json.Unmarshal

* fix after @thinkerou review
2019-03-03 14:39:43 +08:00
André Bazaglia 48f6c6137c allow ignoring field on form mapping (#1733) 2019-02-22 12:23:52 +08:00
Dmitry Kutakov 49e4b0c60c fix mapping inner structs with correct tag (#1718) 2018-12-28 09:57:09 +08:00
thinkerou 521d06c81d support bind uri param (#1612)
* support bind uri (1)

* uri binding successful run

* fix vet warning: github.com/gin-gonic/gin/internal.Param composite literal uses unkeyed fields

* fix code style

* update function name

* fix test function signature

* add test for CanSet

* update readme and add test case

* remove internal.Params

* add coverage

* fix warning
2018-11-22 09:29:48 +08:00
田欧 85f3e78abc chore: remove else instead of return/continue (#1502)
As[ Effective Go](https://golang.org/doc/effective_go.html?#if) about `if` said, remove else statement instead of return/continue statement.
2018-08-20 21:49:24 +08:00
Alexander Lokhman 7eb0f74b89 Set default time format in form binding (#1487) 2018-08-17 09:41:56 +08:00
chainhelen 5636afe02d fix bug, return err when failed binding bool (#1350)
* fix bug, return err when failed binding bool

* add test, return err when failed binding bool
2018-05-11 22:40:33 +08:00
田欧 bd4f73af67 support struct pointer (#1342)
* support struct pointer

* add readme
2018-05-01 14:24:18 +08:00
Alexander Lokhman 2282be059b Add support of pointers in form binding (#1336)
* Add support of pointers in form binding

* Add tests for pointer form binding
2018-04-26 22:09:34 +08:00
田欧 41f951e0cd support default value for form (#1138)
* support default value for form

* fix bug for nil interface

* use SplitN and optimization code

* add test case

* add test cases for form(own default value)

* fix invalid code

* fix code indent

* assert order
2018-04-25 16:24:03 +08:00
Boris Borshevsky 6f94fd05c9 Linting and optimizing struct memory signature. (#1184)
* fix cleanPath spell (#969)

* linter and optimize structs
2017-11-29 10:50:14 +08:00
delphinus a8c53949e5 Support time location on form binding (#1117) 2017-09-28 22:23:18 +08:00
Bo-Yi Wu 1e1e4fc867 Add Makefile to check the following thing (#947)
* Add Makefile to check the following thing.

* vet check
* fmt check
* embedmd check
* misspell check

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* remove unused variable.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-06-12 21:50:42 -05:00
Andrey Nering 6a3a8ae61b Fix time.Time binding (#904)
If a empty string is given(`""`), them time should be zero.
2017-05-04 09:22:00 +08:00
Andrey Nering 863248034b Support time.Time on form binding (#801) 2017-02-17 21:32:36 +08:00
Manu Mtz-Almeida 0873992f38 More unit tests for form binding 2015-07-08 04:26:37 +02:00
Manu Mtz-Almeida 967e62337a form mapping optimisation 2015-05-24 03:56:11 +02:00
Manu Mtz-Almeida 208e1f5569 Merge branch 'master' of https://github.com/remerge/gin
Conflicts:
	binding/binding.go
2015-05-24 03:33:21 +02:00
Manu Mtz-Almeida 8b26264574 Merge branch 'develop' into performance
Conflicts:
	context.go
	context_test.go
	gin_test.go
	recovery_test.go
	utils.go
2015-04-08 13:37:25 +02:00
Manu Mtz-Almeida ac0ad2fed8 Improves unit tests 2015-04-08 02:58:35 +02:00
Manu Mtz-Almeida 9828435f70 Fixes failing unit test 2015-04-07 18:14:33 +02:00
Manu Mtz-Almeida 1f6304ca25 Cleaning up performance branch 2015-04-07 12:22:38 +02:00
Manu Mtz-Almeida d4413b6e91 Refactors binding module 2015-03-31 17:51:10 +02:00