2021-04-30 13:10:07 +02:00
|
|
|
package httpin
|
|
|
|
|
2021-05-03 16:19:54 +02:00
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
|
2021-05-08 09:27:37 +02:00
|
|
|
"github.com/ggicci/httpin/internal"
|
|
|
|
)
|
2021-05-03 16:19:54 +02:00
|
|
|
|
2021-05-08 09:27:37 +02:00
|
|
|
type Decoder internal.Decoder
|
2021-05-03 16:19:54 +02:00
|
|
|
|
2021-05-08 09:27:37 +02:00
|
|
|
var decoders = map[reflect.Type]Decoder{} // custom decoders
|
2021-05-03 16:19:54 +02:00
|
|
|
|
|
|
|
func decoderOf(t reflect.Type) Decoder {
|
2021-05-08 09:27:37 +02:00
|
|
|
dec := decoders[t]
|
2021-05-03 16:19:54 +02:00
|
|
|
if dec != nil {
|
|
|
|
return dec
|
|
|
|
}
|
2021-05-08 09:27:37 +02:00
|
|
|
return internal.DecoderOf(t)
|
2021-05-03 16:19:54 +02:00
|
|
|
}
|