Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support binding for slice/array obj #2194

Closed
wants to merge 40 commits into from
Closed

Support binding for slice/array obj #2194

wants to merge 40 commits into from

Conversation

wuhuizuo
Copy link
Contributor

support usage followed:

type StructExample struct {
    A string `json:"a" form:"a" binding"required,max=16"`
}

func exampleHandler(c *gin.Context) {
    var data []StructExample

    if c.Bind(&data) != nil {
        return
    }
    c.JSON(http.StatusOK, data)
}

@codecov
Copy link

codecov bot commented Dec 25, 2019

Codecov Report

Merging #2194 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2194   +/-   ##
=======================================
  Coverage   98.49%   98.49%           
=======================================
  Files          41       41           
  Lines        2319     2319           
=======================================
  Hits         2284     2284           
  Misses         20       20           
  Partials       15       15           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ff1bfa...2ff1bfa. Read the comment docs.

@appleboy appleboy added this to the 1.6 milestone Dec 26, 2019
@wuhuizuo wuhuizuo requested a review from appleboy December 27, 2019 03:38
appleboy
appleboy previously approved these changes Dec 27, 2019
@appleboy appleboy requested a review from thinkerou December 27, 2019 07:23
jbampton and others added 16 commits March 26, 2020 15:36
* add build tag nomsgpack

* Update copyright

* Update copyright
* path: use stack buffer in CleanPath to avoid allocs in common case

Sync from julienschmidt/httprouter@8222db1

* path: sync test code from httprouter

* path: update path_test.go to the latest code

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Use zero-copy approach to convert types between string and byte slice

* Rename argument to a eligible one

Benchmark:

BenchmarkBytesConvBytesToStrRaw-4   	21003800	        70.9 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvBytesToStr-4      	1000000000	         0.333 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4   	18478059	        59.3 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvStrToBytes-4      	1000000000	         0.373 ns/op	       0 B/op	       0 allocs/op


Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Added support for SameSite cookie flag

* fixed tests.

* Update context.go

* Update context_test.go

* Update context_test.go

Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* chore(path): improve comments

copy from julienschmidt/httprouter@15782a7

* fix typo

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
copy from julienschmidt/httprouter@cfa3cb7

Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
fix #2236

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
KaushikNeelichetty and others added 24 commits March 26, 2020 15:36
#2209 (#2228)

* ignore IntelliJ idea generated files

* update JSON renderer to use Marshall() instead of Encode(). Fix #2209

* Revert "ignore IntelliJ idea generated files"

This reverts commit e7bd017.

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
* Context.FileFromFS added

* Context File and FileFromFS examples at README

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
* do not set unix socket permissions. Cleanup unix socket.

* removed useless error checking
* Add mutex for protect Context.Keys map

* Fix tests

Co-authored-by: Nikolay Tolkachov <nik.tolkachov@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
to sync with tag v1.6.0
Co-authored-by: thinkerou <thinkerou@gmail.com>
* doc: add pr link

* doc: add v1.6.1 release note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.