Commit Graph

18 Commits

Author SHA1 Message Date
Name 3f5b0afa2a
refactor(slice): simplify SliceValidationError Error method (#3910)
* Simplify SliceValidationError Error method

* Replace fmt.Fprintf with b.WriteString

---------

Co-authored-by: huangzw <huangzw@hsmap.com>
Co-authored-by: 1911860538 <alxps1911@163.com>
2024-05-13 13:32:46 +08:00
Alonso Villegas 82bcd6d39b
fix(binding): dereference pointer to struct (#3199) 2024-02-07 19:44:11 +08:00
Jesse 51aea73ba0
fix: modify interface check way (#3327) 2022-10-20 00:49:19 +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
edebernis 57ede9c95a
Export struct sliceValidateError to allow error casting and rename it as (#2777)
SliceValidationError

Co-authored-by: Emeric de Bernis <emeric.debernis@adevinta.com>
2021-11-21 21:45:03 +08:00
ziheng e3ee01d185
improve sliceValidateError.Error performance using switch and strings.Builder (#2765)
fix missing nil pointer check

use simpler switch case

add missing tests

use for-loop instead of range

add benchmark test codes
2021-06-28 22:05:29 +08:00
iamhesir 0cbb30aa94
Update default validator's docs link (#2738)
The default validator has upgraded from v8 to v10, but its docs link didn't.
2021-05-26 18:46:13 +08:00
wuhuizuo 4bfae4c8c8
Support binding for slice/array obj [Rewrite] (#2302)
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-01-03 21:43:34 +08:00
Xudong Cai e90e2ba9b3 upgrade go-validator to v10 (#2149)
* upgrade go-validator to v10

* fix fmt
2019-11-25 14:49:45 +08:00
thinkerou 1acb3fb30a
upgrade validator version to v9 (#1015)
* upgrade validator version to v9

* Update vendor.json

* Update go.mod

* Update go.sum

* fix

* fix

* fix bug

* Update binding_test.go

* Update validate_test.go

* Update go.sum

* Update go.mod

* Update go.sum

* Update go.mod

* Update go.sum
2019-09-05 21:39:56 +08:00
田欧 cdd02fa9d6 update error(err) to err (#1416)
the pull request update `return error(err)` to `return err`, and remove `kindOfData`.
2018-07-01 21:10:48 +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
Suhas Karanth 26c3f42095 feat(binding): add support for custom validator / validation tags (#1068)
* feat(binding): Add support for custom validation tags

* docs: Add example for custom validation tag

* test(binding): Add test for registering custom validation
2017-08-27 09:37:39 +02:00
田欧 4ad3baf44e Add license for some files (#940) 2017-06-12 01:04:52 -05:00
Manu Mtz.-Almeida ffb5c0412a Updates Validator + unit tests 2016-01-26 19:28:26 +01:00
Manu Mtz-Almeida 0c9f086b74 Renames Validate() to validate() 2015-05-31 16:30:00 +02:00
Manu Mtz-Almeida fecde9fed6 Refactors binding validation 2015-05-31 16:18:50 +02:00