Former-commit-id: 23f795a6b6b64745311d0630d8e630edc3f65244
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-06-20 16:06:26 +03:00
parent 04c8b79b1f
commit 45c6bce15f
18 changed files with 30 additions and 16 deletions

View File

@ -197,7 +197,7 @@
* [Login (Repository and Service layers)](mvc/login) * [Login (Repository and Service layers)](mvc/login)
* [Login (Single Responsibility)](mvc/login-mvc-single-responsibility) * [Login (Single Responsibility)](mvc/login-mvc-single-responsibility)
* [Vue.js Todo App](mvc/vuejs-todo-mvc) * [Vue.js Todo App](mvc/vuejs-todo-mvc)
* [Bootstrapper](bootstrap) * [Bootstrapper](bootstrapper)
* Desktop Applications * Desktop Applications
* [The blink package](desktop/blink) * [The blink package](desktop/blink)
* [The lorca package](desktop/lorca) * [The lorca package](desktop/lorca)

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

20
go.mod
View File

@ -13,7 +13,7 @@ require (
github.com/golang/protobuf v1.4.2 github.com/golang/protobuf v1.4.2
github.com/gomodule/redigo v1.8.2 github.com/gomodule/redigo v1.8.2
github.com/google/uuid v1.1.2-0.20200519141726-cb32006e483f github.com/google/uuid v1.1.2-0.20200519141726-cb32006e483f
github.com/hashicorp/go-version v1.2.0 github.com/hashicorp/go-version v1.2.1
github.com/iris-contrib/blackfriday v2.0.0+incompatible github.com/iris-contrib/blackfriday v2.0.0+incompatible
github.com/iris-contrib/httpexpect/v2 v2.0.5 github.com/iris-contrib/httpexpect/v2 v2.0.5
github.com/iris-contrib/jade v1.1.4 github.com/iris-contrib/jade v1.1.4
@ -24,19 +24,19 @@ require (
github.com/kataras/neffos v0.0.16 github.com/kataras/neffos v0.0.16
github.com/kataras/pio v0.0.8 github.com/kataras/pio v0.0.8
github.com/kataras/sitemap v0.0.5 github.com/kataras/sitemap v0.0.5
github.com/klauspost/compress v1.10.6 github.com/klauspost/compress v1.10.9
github.com/mediocregopher/radix/v3 v3.5.1 github.com/mediocregopher/radix/v3 v3.5.1
github.com/microcosm-cc/bluemonday v1.0.2 github.com/microcosm-cc/bluemonday v1.0.3
github.com/ryanuber/columnize v2.1.0+incompatible github.com/ryanuber/columnize v2.1.0+incompatible
github.com/schollz/closestmatch v2.1.0+incompatible github.com/schollz/closestmatch v2.1.0+incompatible
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/square/go-jose/v3 v3.0.0-20200430180204-d84c719419c2 github.com/square/go-jose/v3 v3.0.0-20200603004136-8ccb8a19e809
github.com/vmihailenco/msgpack/v5 v5.0.0-alpha.2 github.com/vmihailenco/msgpack/v5 v5.0.0-beta.1
go.etcd.io/bbolt v1.3.4 go.etcd.io/bbolt v1.3.5
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 golang.org/x/net v0.0.0-20200602114024-627f9648deb9
golang.org/x/text v0.3.2 golang.org/x/text v0.3.3
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
gopkg.in/ini.v1 v1.57.0 gopkg.in/ini.v1 v1.57.0
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86 gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
) )

View File

@ -221,7 +221,7 @@ func getBindingsFor(inputs []reflect.Type, deps []*Dependency, paramsCount int)
func isPayloadType(in reflect.Type) bool { func isPayloadType(in reflect.Type) bool {
switch indirectType(in).Kind() { switch indirectType(in).Kind() {
case reflect.Struct, reflect.Slice: case reflect.Struct, reflect.Slice, reflect.Ptr:
return true return true
default: default:
return false return false

View File

@ -719,8 +719,20 @@ func (*testControllerMethodHandlerBindStruct) Any(data bindStructData) bindStruc
return data return data
} }
func (*testControllerMethodHandlerBindStruct) PostByProducts(id uint64, data []bindStructData) []bindStructData { func (*testControllerMethodHandlerBindStruct) PostBySlice(id uint64, manyData []bindStructData) []bindStructData {
return data return manyData
}
type dataSlice []bindStructData
func (*testControllerMethodHandlerBindStruct) PostBySlicetype(id uint64, manyData dataSlice) dataSlice {
return manyData
}
type dataSlicePtr []*bindStructData
func (*testControllerMethodHandlerBindStruct) PostBySlicetypeptr(id uint64, manyData dataSlicePtr) dataSlicePtr {
return manyData
} }
func TestControllerMethodHandlerBindStruct(t *testing.T) { func TestControllerMethodHandlerBindStruct(t *testing.T) {
@ -734,11 +746,13 @@ func TestControllerMethodHandlerBindStruct(t *testing.T) {
m.Handle(new(testControllerMethodHandlerBindStruct)) m.Handle(new(testControllerMethodHandlerBindStruct))
data := bindStructData{Name: "kataras"} data := bindStructData{Name: "kataras"}
manyData := []bindStructData{{"kataras"}, {"john doe"}} manyData := []bindStructData{data, {"john doe"}}
e := httptest.New(t, app) e := httptest.New(t, app)
e.GET("/data").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().Equal(data) e.GET("/data").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().Equal(data)
e.PATCH("/data").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().Equal(data) e.PATCH("/data").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().Equal(data)
e.POST("/data/42/products").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData) e.POST("/data/42/slice").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData)
e.POST("/data/42/slicetype").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData)
e.POST("/data/42/slicetypeptr").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData)
// more tests inside the hero package itself. // more tests inside the hero package itself.
} }