Commit Graph

21 Commits

Author SHA1 Message Date
thinkerou 1e1f0b1e76
chore: support min go version 1.18 (#3511)
* chore: min go version 1.18

* fix build tag error

* remove build tag

* fix word

* remove any.go

* replace interface{} instead of any
2023-03-01 10:03:48 +08:00
thinkerou 4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
thinkerou 2bde107686
test support go1.18 (#2990) 2022-03-21 09:43:17 +08:00
Qt 215c9ce231
use errors.New to replace fmt.Errorf will much better (#2707) 2021-04-28 18:39:09 +08:00
Krzysztof Szafrański f38c30a0d2 feat(binding): add DisallowUnknownFields() in gin.Context.BindJSON() (#2028) 2019-09-06 13:56:59 +08:00
mllu 64457fbca7 handle nil body for JSON binding (#1638) 2018-11-22 09:55:51 +08:00
田欧 72db8acd99
add internal package which includes json package (#1504) 2018-08-30 19:04:03 +08:00
JINNOUCHI Yasushi 995fa8e9ce Fix #216: Enable to call binding multiple times in some formats (#1341)
* Add interface to read body bytes in binding

* Add BindingBody implementation for some binding

* Fix to use `BindBodyBytesKey` for key

* Revert "Fix to use `BindBodyBytesKey` for key"

This reverts commit 2c82901cea.

* Use private-like key for body bytes

* Add tests for BindingBody & ShouldBindBodyWith

* Add note for README

* Remove redundant space between sentences
2018-05-11 10:33:33 +08:00
Suhas Karanth 6d913fc343 fix(binding): Expose validator engine used by the default Validator (#1277)
* fix(binding): Expose validator engine used by the default Validator

- Add func ValidatorEngine for returning the underlying validator engine used
  in the default StructValidator implementation.
- Remove the function RegisterValidation from the StructValidator interface
  which made it immpossible to use a StructValidator implementation without the
  validator.v8 library.
- Update and rename test for registering validation
  Test{RegisterValidation => ValidatorEngine}.
- Update readme and example for registering custom validation.
- Add example for registering struct level validation.
- Add documentation for the following binding funcs/types:
  - Binding interface
  - StructValidator interface
  - Validator instance
  - Binding implementations
  - Default func

* fix(binding): Move validator engine getter inside interface

* docs: rm date cmd from custom validation demo
2018-03-29 14:33:07 +08:00
田欧 b7e8a6b9b0 style(import): not use aliase when import package (#1146) 2017-10-29 13:12:22 +01:00
Bo-Yi Wu ce670a6497 refactor(json): make jsonite optional with build tags (#1026)
* refactor(json): Restore gin support for app engine

Create new folder to support multiple json package.
restore gin support for app engine (disable jsonite through tags)

use jsoniter

$ go build -tags=jsoniter .

use default json

$ go build .

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

* rename json file.

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

* docs(json): add build tags document.

* fix(docs): markdown format.

* fix(json): missing space.
2017-07-18 23:01:29 +02:00
whirosan fb7448f081 feat(binding): add UseNumber() in gin.Context.BindJSON() (#997) close #368
* resolve #368 add option to UseNumber() in gin.Context.BindJSON()

* add test
2017-07-10 10:33:35 +02:00
Bo-Yi Wu e23842ecab
fix json sort the map keys
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-08 18:19:09 +08:00
Bo-Yi Wu 12508320c2
feat: change json lib to jsoniter
A high-performance 100% compatible drop-in replacement of "encoding/json"

https://github.com/json-iterator/go

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-08 16:51:36 +08:00
田欧 d922143bc5 lint code for import (#939) 2017-06-11 21:40:15 -05:00
Manu Mtz-Almeida 0494e1b66a Removes unused underscore 2015-07-10 13:06:01 +02:00
Manu Mtz-Almeida 0c9f086b74 Renames Validate() to validate() 2015-05-31 16:30:00 +02:00
Manu Mtz-Almeida 0a192fb0fa Tons of unit tests 2015-04-09 12:15:02 +02:00
Manu Mtz-Almeida a887e395f3 Fixes integration with "go-validate-yourself"
http://stackoverflow.com/questions/29138591/hiding-nil-values-understanding-why-golang-fails-here
2015-04-07 16:06:53 +02:00
Manu Mtz-Almeida ee3b67eda1 Experimenting with new validation library!!! 2015-04-07 12:30:16 +02:00
Manu Mtz-Almeida d4413b6e91 Refactors binding module 2015-03-31 17:51:10 +02:00