diff options
Diffstat (limited to 'utils/env/validators.go')
| -rw-r--r-- | utils/env/validators.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/env/validators.go b/utils/env/validators.go new file mode 100644 index 0000000..fa9b17f --- /dev/null +++ b/utils/env/validators.go @@ -0,0 +1,15 @@ +package env + +import ( + "fmt" + "reflect" +) + +func validateConfigInput(config any) (reflect.Value, reflect.Type, error) { + v := reflect.ValueOf(config) + if v.Kind() != reflect.Pointer || v.Elem().Kind() != reflect.Struct { + return reflect.Value{}, nil, fmt.Errorf("config must be a pointer to struct") + } + elem := v.Elem() + return elem, elem.Type(), nil +} |
