summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-playground/form/v4/util.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/go-playground/form/v4/util.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/go-playground/form/v4/util.go')
-rw-r--r--vendor/github.com/go-playground/form/v4/util.go62
1 files changed, 0 insertions, 62 deletions
diff --git a/vendor/github.com/go-playground/form/v4/util.go b/vendor/github.com/go-playground/form/v4/util.go
deleted file mode 100644
index 02c86af72..000000000
--- a/vendor/github.com/go-playground/form/v4/util.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package form
-
-import (
- "reflect"
- "strconv"
-)
-
-// ExtractType gets the actual underlying type of field value.
-// it is exposed for use within you Custom Functions
-func ExtractType(current reflect.Value) (reflect.Value, reflect.Kind) {
-
- switch current.Kind() {
- case reflect.Ptr:
-
- if current.IsNil() {
- return current, reflect.Ptr
- }
-
- return ExtractType(current.Elem())
-
- case reflect.Interface:
-
- if current.IsNil() {
- return current, reflect.Interface
- }
-
- return ExtractType(current.Elem())
-
- default:
- return current, current.Kind()
- }
-}
-
-func parseBool(str string) (bool, error) {
-
- switch str {
- case "1", "t", "T", "true", "TRUE", "True", "on", "yes", "ok":
- return true, nil
- case "", "0", "f", "F", "false", "FALSE", "False", "off", "no":
- return false, nil
- }
-
- // strconv.NumError mimicing exactly the strconv.ParseBool(..) error and type
- // to ensure compatibility with std library and beyond.
- return false, &strconv.NumError{Func: "ParseBool", Num: str, Err: strconv.ErrSyntax}
-}
-
-// hasValue determines if a reflect.Value is it's default value
-func hasValue(field reflect.Value) bool {
- switch field.Kind() {
- case reflect.Slice, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func:
- return !field.IsNil()
- default:
- if !field.IsValid() {
- return false
- }
- if !field.Type().Comparable() {
- return true
- }
- return field.Interface() != reflect.Zero(field.Type()).Interface()
- }
-}