mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-03 09:25:29 +00:00
26 lines
396 B
Go
26 lines
396 B
Go
![]() |
package hook
|
||
|
|
||
|
import (
|
||
|
"reflect"
|
||
|
|
||
|
"github.com/mitchellh/mapstructure"
|
||
|
)
|
||
|
|
||
|
func Base64ToBytesHookFunc() mapstructure.DecodeHookFuncType {
|
||
|
return func(
|
||
|
f reflect.Type,
|
||
|
t reflect.Type,
|
||
|
data interface{},
|
||
|
) (interface{}, error) {
|
||
|
if f.Kind() != reflect.String {
|
||
|
return data, nil
|
||
|
}
|
||
|
|
||
|
if t != reflect.TypeOf([]byte{}) {
|
||
|
return data, nil
|
||
|
}
|
||
|
|
||
|
return []byte(data.(string)), nil
|
||
|
}
|
||
|
}
|