summaryrefslogtreecommitdiff
path: root/vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-04-25 15:15:36 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-25 15:15:36 +0200
commitffde1b150faca940bc6c172068aa068cf468aa39 (patch)
tree2b325bf50946b95502d948d5700c148d667346d8 /vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go
parent[chore] Update `activity` to v1.14.0 (#4038) (diff)
downloadgotosocial-ffde1b150faca940bc6c172068aa068cf468aa39.tar.xz
[chore] Move deps to code.superseriousbusiness.org (#4054)
Diffstat (limited to 'vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go')
-rw-r--r--vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go b/vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go
new file mode 100644
index 000000000..12dabf187
--- /dev/null
+++ b/vendor/code.superseriousbusiness.org/activity/streams/values/langString/gen_langString.go
@@ -0,0 +1,63 @@
+// Code generated by astool. DO NOT EDIT.
+
+package langstring
+
+import (
+ "fmt"
+ "sort"
+)
+
+// SerializeLangString converts a langString value to an interface representation
+// suitable for marshalling into a text or binary format.
+func SerializeLangString(this map[string]string) (interface{}, error) {
+ return this, nil
+}
+
+// DeserializeLangString creates langString value from an interface representation
+// that has been unmarshalled from a text or binary format.
+func DeserializeLangString(this interface{}) (map[string]string, error) {
+ if m, ok := this.(map[string]interface{}); ok {
+ r := make(map[string]string)
+ for k, v := range m {
+ if s, ok := v.(string); ok {
+ r[k] = s
+ } else {
+ return nil, fmt.Errorf("value %v cannot be interpreted as a string for rdf:langString", v)
+ }
+ }
+ return r, nil
+ } else {
+ return nil, fmt.Errorf("%v cannot be interpreted as a map[string]interface{} for rdf:langString", this)
+ }
+}
+
+// LessLangString returns true if the left langString value is less than the right
+// value.
+func LessLangString(lhs, rhs map[string]string) bool {
+ var lk []string
+ var rk []string
+ for k := range lhs {
+ lk = append(lk, k)
+ }
+ for k := range rhs {
+ rk = append(rk, k)
+ }
+ sort.Strings(lk)
+ sort.Strings(rk)
+ for i := 0; i < len(lk) && i < len(rk); i++ {
+ if lk[i] < rk[i] {
+ return true
+ } else if rk[i] < lk[i] {
+ return false
+ } else if lhs[lk[i]] < rhs[rk[i]] {
+ return true
+ } else if rhs[rk[i]] < lhs[lk[i]] {
+ return false
+ }
+ }
+ if len(lk) < len(rk) {
+ return true
+ } else {
+ return false
+ }
+}