@@ -9,18 +9,18 @@ import (
99type (
1010 // Binder is the interface that wraps the Bind method.
1111 Binder interface {
12- Bind (interface {} , Context , ... FormDataFilter ) error
13- BindAndValidate (interface {} , Context , ... FormDataFilter ) error
14- MustBind (interface {} , Context , ... FormDataFilter ) error
15- MustBindAndValidate (interface {} , Context , ... FormDataFilter ) error
12+ Bind (any , Context , ... FormDataFilter ) error
13+ BindAndValidate (any , Context , ... FormDataFilter ) error
14+ MustBind (any , Context , ... FormDataFilter ) error
15+ MustBindAndValidate (any , Context , ... FormDataFilter ) error
1616
17- BindWithDecoder (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
18- BindAndValidateWithDecoder (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
19- MustBindWithDecoder (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
20- MustBindAndValidateWithDecoder (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
17+ BindWithDecoder (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
18+ BindAndValidateWithDecoder (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
19+ MustBindWithDecoder (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
20+ MustBindAndValidateWithDecoder (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
2121 }
2222 binder struct {
23- decoders map [string ]func (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
23+ decoders map [string ]func (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error
2424 }
2525
2626 BeforeBind interface {
@@ -29,14 +29,14 @@ type (
2929
3030 // for tag
3131
32- BinderValueDecoder func (field string , values []string , params string ) (interface {} , error )
33- BinderValueEncoder func (field string , value interface {} , params string ) []string
32+ BinderValueDecoder func (field string , values []string , params string ) (any , error )
33+ BinderValueEncoder func (field string , value any , params string ) []string
3434
3535 // for function argument
3636
37- BinderValueCustomDecoder func (values []string ) (interface {} , error )
37+ BinderValueCustomDecoder func (values []string ) (any , error )
3838 BinderValueCustomDecoders map [string ]BinderValueCustomDecoder // 这里的 key 为结构体字段或map的key层级路径
39- BinderValueCustomEncoder func (interface {} ) []string
39+ BinderValueCustomEncoder func (any ) []string
4040 BinderValueCustomEncoders map [string ]BinderValueCustomEncoder // 这里的 key 为表单字段层级路径
4141
4242 ValueDecodersGetter interface {
@@ -81,23 +81,23 @@ func NewBinder(e *Echo) Binder {
8181 }
8282}
8383
84- func (b * binder ) MustBind (i interface {} , c Context , filter ... FormDataFilter ) error {
84+ func (b * binder ) MustBind (i any , c Context , filter ... FormDataFilter ) error {
8585 return b .MustBindWithDecoder (i , c , nil , filter ... )
8686}
8787
88- func (b * binder ) MustBindAndValidate (i interface {} , c Context , filter ... FormDataFilter ) error {
88+ func (b * binder ) MustBindAndValidate (i any , c Context , filter ... FormDataFilter ) error {
8989 return b .MustBindAndValidateWithDecoder (i , c , nil , filter ... )
9090}
9191
92- func (b * binder ) Bind (i interface {} , c Context , filter ... FormDataFilter ) (err error ) {
92+ func (b * binder ) Bind (i any , c Context , filter ... FormDataFilter ) (err error ) {
9393 return b .BindWithDecoder (i , c , nil , filter ... )
9494}
9595
96- func (b * binder ) BindAndValidate (i interface {} , c Context , filter ... FormDataFilter ) error {
96+ func (b * binder ) BindAndValidate (i any , c Context , filter ... FormDataFilter ) error {
9797 return b .BindAndValidateWithDecoder (i , c , nil , filter ... )
9898}
9999
100- func (b * binder ) MustBindWithDecoder (i interface {} , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) error {
100+ func (b * binder ) MustBindWithDecoder (i any , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) error {
101101 if f , y := i .(BeforeBind ); y {
102102 if err := f .BeforeBind (c ); err != nil {
103103 return err
@@ -114,22 +114,22 @@ func (b *binder) MustBindWithDecoder(i interface{}, c Context, valueDecoders Bin
114114 return ErrUnsupportedMediaType
115115}
116116
117- func (b * binder ) MustBindAndValidateWithDecoder (i interface {} , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) error {
117+ func (b * binder ) MustBindAndValidateWithDecoder (i any , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) error {
118118 if err := b .MustBindWithDecoder (i , c , valueDecoders , filter ... ); err != nil {
119119 return err
120120 }
121121 return ValidateStruct (c , i )
122122}
123123
124- func (b * binder ) BindWithDecoder (i interface {} , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) (err error ) {
124+ func (b * binder ) BindWithDecoder (i any , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) (err error ) {
125125 err = b .MustBindWithDecoder (i , c , valueDecoders , filter ... )
126126 if err == ErrUnsupportedMediaType {
127127 err = nil
128128 }
129129 return
130130}
131131
132- func (b * binder ) BindAndValidateWithDecoder (i interface {} , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) error {
132+ func (b * binder ) BindAndValidateWithDecoder (i any , c Context , valueDecoders BinderValueCustomDecoders , filter ... FormDataFilter ) error {
133133 if err := b .MustBindWithDecoder (i , c , valueDecoders , filter ... ); err != nil {
134134 if err != ErrUnsupportedMediaType {
135135 return err
@@ -138,10 +138,10 @@ func (b *binder) BindAndValidateWithDecoder(i interface{}, c Context, valueDecod
138138 return ValidateStruct (c , i )
139139}
140140
141- func (b * binder ) SetDecoders (decoders map [string ]func (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error ) {
141+ func (b * binder ) SetDecoders (decoders map [string ]func (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error ) {
142142 b .decoders = decoders
143143}
144144
145- func (b * binder ) AddDecoder (mime string , decoder func (interface {} , Context , BinderValueCustomDecoders , ... FormDataFilter ) error ) {
145+ func (b * binder ) AddDecoder (mime string , decoder func (any , Context , BinderValueCustomDecoders , ... FormDataFilter ) error ) {
146146 b .decoders [mime ] = decoder
147147}
0 commit comments