summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-playground/form/v4/form.go
diff options
context:
space:
mode:
authorLibravatar zowhoey <11893985+zowhoey@users.noreply.github.com>2023-03-06 09:30:19 +0000
committerLibravatar GitHub <noreply@github.com>2023-03-06 10:30:19 +0100
commitf518f649f800e52d32fe53580c528ffa042f7154 (patch)
treec14bb8b513008d1c1e7bab0908cfc99fe18f1507 /vendor/github.com/go-playground/form/v4/form.go
parent[chore]: Bump github.com/jackc/pgx/v4 from 4.17.2 to 4.18.1 (#1595) (diff)
downloadgotosocial-f518f649f800e52d32fe53580c528ffa042f7154.tar.xz
[feature] Add support for profile fields (#1483)
* Add go-playground/form pkg * [feature] Add support for profile fields * Add field attributes test * Validate profile fields form * Add profile field validation tests * Add Field Attributes definition to swagger --------- Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/go-playground/form/v4/form.go')
-rw-r--r--vendor/github.com/go-playground/form/v4/form.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/github.com/go-playground/form/v4/form.go b/vendor/github.com/go-playground/form/v4/form.go
new file mode 100644
index 000000000..b1b4e7dc2
--- /dev/null
+++ b/vendor/github.com/go-playground/form/v4/form.go
@@ -0,0 +1,49 @@
+package form
+
+import (
+ "reflect"
+ "time"
+)
+
+const (
+ blank = ""
+ ignore = "-"
+ fieldNS = "Field Namespace:"
+ errorText = " ERROR:"
+)
+
+var (
+ timeType = reflect.TypeOf(time.Time{})
+)
+
+// Mode specifies which mode the form decoder is to run
+type Mode uint8
+
+const (
+
+ // ModeImplicit tries to parse values for all
+ // fields that do not have an ignore '-' tag
+ ModeImplicit Mode = iota
+
+ // ModeExplicit only parses values for field with a field tag
+ // and that tag is not the ignore '-' tag
+ ModeExplicit
+)
+
+// AnonymousMode specifies how data should be rolled up
+// or separated from anonymous structs
+type AnonymousMode uint8
+
+const (
+ // AnonymousEmbed embeds anonymous data when encoding
+ // eg. type A struct { Field string }
+ // type B struct { A, Field string }
+ // encode results: url.Values{"Field":[]string{"B FieldVal", "A FieldVal"}}
+ AnonymousEmbed AnonymousMode = iota
+
+ // AnonymousSeparate does not embed anonymous data when encoding
+ // eg. type A struct { Field string }
+ // type B struct { A, Field string }
+ // encode results: url.Values{"Field":[]string{"B FieldVal"}, "A.Field":[]string{"A FieldVal"}}
+ AnonymousSeparate
+)