diff options
author | 2021-11-13 17:29:43 +0100 | |
---|---|---|
committer | 2021-11-13 17:29:43 +0100 | |
commit | 09ef9e639efa1b01005dcb7fc044611f277ad618 (patch) | |
tree | bef200f444b7ddd90f2b9f0fcff644da7cd85a11 /vendor/github.com/go-fed/activity/streams/values | |
parent | update dependencies (#296) (diff) | |
download | gotosocial-09ef9e639efa1b01005dcb7fc044611f277ad618.tar.xz |
move to ssb gofed fork (#298)
Diffstat (limited to 'vendor/github.com/go-fed/activity/streams/values')
11 files changed, 0 insertions, 483 deletions
diff --git a/vendor/github.com/go-fed/activity/streams/values/anyURI/gen_anyURI.go b/vendor/github.com/go-fed/activity/streams/values/anyURI/gen_anyURI.go deleted file mode 100644 index a1ac814af..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/anyURI/gen_anyURI.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package anyuri - -import ( - "fmt" - "net/url" -) - -// SerializeAnyURI converts a anyURI value to an interface representation suitable -// for marshalling into a text or binary format. -func SerializeAnyURI(this *url.URL) (interface{}, error) { - return this.String(), nil -} - -// DeserializeAnyURI creates anyURI value from an interface representation that -// has been unmarshalled from a text or binary format. -func DeserializeAnyURI(this interface{}) (*url.URL, error) { - var u *url.URL - var err error - if s, ok := this.(string); ok { - u, err = url.Parse(s) - if err != nil { - err = fmt.Errorf("%v cannot be interpreted as a xsd:anyURI: %s", this, err) - } else if len(u.Scheme) == 0 { - err = fmt.Errorf("%v cannot be interpreted as a xsd:anyURI: no scheme", this) - } - } else { - err = fmt.Errorf("%v cannot be interpreted as a string for xsd:anyURI", this) - } - return u, err -} - -// LessAnyURI returns true if the left anyURI value is less than the right value. -func LessAnyURI(lhs, rhs *url.URL) bool { - return lhs.String() < rhs.String() -} diff --git a/vendor/github.com/go-fed/activity/streams/values/bcp47/gen_bcp47.go b/vendor/github.com/go-fed/activity/streams/values/bcp47/gen_bcp47.go deleted file mode 100644 index 0e0f70485..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/bcp47/gen_bcp47.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package bcp47 - -import "fmt" - -// SerializeBcp47 converts a bcp47 value to an interface representation suitable -// for marshalling into a text or binary format. -func SerializeBcp47(this string) (interface{}, error) { - return this, nil -} - -// DeserializeBcp47 creates bcp47 value from an interface representation that has -// been unmarshalled from a text or binary format. -func DeserializeBcp47(this interface{}) (string, error) { - if s, ok := this.(string); ok { - return s, nil - } else { - return "", fmt.Errorf("%v cannot be interpreted as a string for bcp47 languagetag", this) - } -} - -// LessBcp47 returns true if the left bcp47 value is less than the right value. -func LessBcp47(lhs, rhs string) bool { - return lhs < rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/boolean/gen_boolean.go b/vendor/github.com/go-fed/activity/streams/values/boolean/gen_boolean.go deleted file mode 100644 index 1c75e485d..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/boolean/gen_boolean.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package boolean - -import "fmt" - -// SerializeBoolean converts a boolean value to an interface representation -// suitable for marshalling into a text or binary format. -func SerializeBoolean(this bool) (interface{}, error) { - return this, nil -} - -// DeserializeBoolean creates boolean value from an interface representation that -// has been unmarshalled from a text or binary format. -func DeserializeBoolean(this interface{}) (bool, error) { - if b, ok := this.(bool); ok { - return b, nil - } else if f, ok := this.(float64); ok { - if f == 0 { - return false, nil - } else if f == 1 { - return true, nil - } else { - return false, fmt.Errorf("%v cannot be interpreted as a bool float64 for xsd:boolean", this) - } - } else { - return false, fmt.Errorf("%v cannot be interpreted as a bool for xsd:boolean", this) - } -} - -// LessBoolean returns true if the left boolean value is less than the right value. -func LessBoolean(lhs, rhs bool) bool { - // Booleans don't have a natural ordering, so we pick that truth is greater than falsehood. - return !lhs && rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/dateTime/gen_dateTime.go b/vendor/github.com/go-fed/activity/streams/values/dateTime/gen_dateTime.go deleted file mode 100644 index 327152fdb..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/dateTime/gen_dateTime.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package datetime - -import ( - "fmt" - "time" -) - -// SerializeDateTime converts a dateTime value to an interface representation -// suitable for marshalling into a text or binary format. -func SerializeDateTime(this time.Time) (interface{}, error) { - return this.Format(time.RFC3339), nil -} - -// DeserializeDateTime creates dateTime value from an interface representation -// that has been unmarshalled from a text or binary format. -func DeserializeDateTime(this interface{}) (time.Time, error) { - var tmp time.Time - var err error - if s, ok := this.(string); ok { - tmp, err = time.Parse(time.RFC3339, s) - if err != nil { - tmp, err = time.Parse("2006-01-02T15:04Z07:00", s) - if err != nil { - err = fmt.Errorf("%v cannot be interpreted as xsd:datetime", this) - } - } - } else { - err = fmt.Errorf("%v cannot be interpreted as a string for xsd:datetime", this) - } - return tmp, err -} - -// LessDateTime returns true if the left dateTime value is less than the right -// value. -func LessDateTime(lhs, rhs time.Time) bool { - return lhs.Before(rhs) -} diff --git a/vendor/github.com/go-fed/activity/streams/values/duration/gen_duration.go b/vendor/github.com/go-fed/activity/streams/values/duration/gen_duration.go deleted file mode 100644 index 8125a6822..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/duration/gen_duration.go +++ /dev/null @@ -1,146 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package duration - -import ( - "fmt" - "math" - "regexp" - "strconv" - "time" -) - -// SerializeDuration converts a duration value to an interface representation -// suitable for marshalling into a text or binary format. -func SerializeDuration(this time.Duration) (interface{}, error) { - // Seriously questioning my life choices. - s := "P" - if this < 0 { - s = "-P" - this = -1 * this - } - var tally time.Duration - // Assume 8760 Hours per 365 days, cannot account for leap years in xsd:duration. :( - if years := this.Hours() / 8760.0; years >= 1 { - nYears := int64(math.Floor(years)) - tally += time.Duration(nYears) * 8760 * time.Hour - s = fmt.Sprintf("%s%dY", s, nYears) - } - // Assume 30 days per month, cannot account for months lasting 31, 30, 29, or 28 days in xsd:duration. :( - if months := (this.Hours() - tally.Hours()) / 720.0; months >= 1 { - nMonths := int64(math.Floor(months)) - tally += time.Duration(nMonths) * 720 * time.Hour - s = fmt.Sprintf("%s%dM", s, nMonths) - } - if days := (this.Hours() - tally.Hours()) / 24.0; days >= 1 { - nDays := int64(math.Floor(days)) - tally += time.Duration(nDays) * 24 * time.Hour - s = fmt.Sprintf("%s%dD", s, nDays) - } - if tally < this { - s = fmt.Sprintf("%sT", s) - if hours := this.Hours() - tally.Hours(); hours >= 1 { - nHours := int64(math.Floor(hours)) - tally += time.Duration(nHours) * time.Hour - s = fmt.Sprintf("%s%dH", s, nHours) - } - if minutes := this.Minutes() - tally.Minutes(); minutes >= 1 { - nMinutes := int64(math.Floor(minutes)) - tally += time.Duration(nMinutes) * time.Minute - s = fmt.Sprintf("%s%dM", s, nMinutes) - } - if seconds := this.Seconds() - tally.Seconds(); seconds >= 1 { - nSeconds := int64(math.Floor(seconds)) - tally += time.Duration(nSeconds) * time.Second - s = fmt.Sprintf("%s%dS", s, nSeconds) - } - } - return s, nil -} - -// DeserializeDuration creates duration value from an interface representation -// that has been unmarshalled from a text or binary format. -func DeserializeDuration(this interface{}) (time.Duration, error) { - // Maybe this time it will be easier. - if s, ok := this.(string); ok { - isNeg := false - if s[0] == '-' { - isNeg = true - s = s[1:] - } - if s[0] != 'P' { - return 0, fmt.Errorf("%s malformed: missing 'P' for xsd:duration", s) - } - re := regexp.MustCompile(`P(\d*Y)?(\d*M)?(\d*D)?(T(\d*H)?(\d*M)?(\d*S)?)?`) - res := re.FindStringSubmatch(s) - var dur time.Duration - nYear := res[1] - if len(nYear) > 0 { - nYear = nYear[:len(nYear)-1] - vYear, err := strconv.ParseInt(nYear, 10, 64) - if err != nil { - return 0, err - } - // Assume 8760 Hours per 365 days, cannot account for leap years in xsd:duration. :( - dur += time.Duration(vYear) * time.Hour * 8760 - } - nMonth := res[2] - if len(nMonth) > 0 { - nMonth = nMonth[:len(nMonth)-1] - vMonth, err := strconv.ParseInt(nMonth, 10, 64) - if err != nil { - return 0, err - } - // Assume 30 days per month, cannot account for months lasting 31, 30, 29, or 28 days in xsd:duration. :( - dur += time.Duration(vMonth) * time.Hour * 720 - } - nDay := res[3] - if len(nDay) > 0 { - nDay = nDay[:len(nDay)-1] - vDay, err := strconv.ParseInt(nDay, 10, 64) - if err != nil { - return 0, err - } - dur += time.Duration(vDay) * time.Hour * 24 - } - nHour := res[5] - if len(nHour) > 0 { - nHour = nHour[:len(nHour)-1] - vHour, err := strconv.ParseInt(nHour, 10, 64) - if err != nil { - return 0, err - } - dur += time.Duration(vHour) * time.Hour - } - nMinute := res[6] - if len(nMinute) > 0 { - nMinute = nMinute[:len(nMinute)-1] - vMinute, err := strconv.ParseInt(nMinute, 10, 64) - if err != nil { - return 0, err - } - dur += time.Duration(vMinute) * time.Minute - } - nSecond := res[7] - if len(nSecond) > 0 { - nSecond = nSecond[:len(nSecond)-1] - vSecond, err := strconv.ParseInt(nSecond, 10, 64) - if err != nil { - return 0, err - } - dur += time.Duration(vSecond) * time.Second - } - if isNeg { - dur *= -1 - } - return dur, nil - } else { - return 0, fmt.Errorf("%v cannot be interpreted as a string for xsd:duration", this) - } -} - -// LessDuration returns true if the left duration value is less than the right -// value. -func LessDuration(lhs, rhs time.Duration) bool { - return lhs < rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/float/gen_float.go b/vendor/github.com/go-fed/activity/streams/values/float/gen_float.go deleted file mode 100644 index 7b88a6e66..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/float/gen_float.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package float - -import "fmt" - -// SerializeFloat converts a float value to an interface representation suitable -// for marshalling into a text or binary format. -func SerializeFloat(this float64) (interface{}, error) { - return this, nil -} - -// DeserializeFloat creates float value from an interface representation that has -// been unmarshalled from a text or binary format. -func DeserializeFloat(this interface{}) (float64, error) { - if f, ok := this.(float64); ok { - return f, nil - } else { - return 0, fmt.Errorf("%v cannot be interpreted as a float64 for xsd:float", this) - } -} - -// LessFloat returns true if the left float value is less than the right value. -func LessFloat(lhs, rhs float64) bool { - return lhs < rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/langString/gen_langString.go b/vendor/github.com/go-fed/activity/streams/values/langString/gen_langString.go deleted file mode 100644 index 12dabf187..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/langString/gen_langString.go +++ /dev/null @@ -1,63 +0,0 @@ -// 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 - } -} diff --git a/vendor/github.com/go-fed/activity/streams/values/nonNegativeInteger/gen_nonNegativeInteger.go b/vendor/github.com/go-fed/activity/streams/values/nonNegativeInteger/gen_nonNegativeInteger.go deleted file mode 100644 index 020c68bab..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/nonNegativeInteger/gen_nonNegativeInteger.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package nonnegativeinteger - -import "fmt" - -// SerializeNonNegativeInteger converts a nonNegativeInteger value to an interface -// representation suitable for marshalling into a text or binary format. -func SerializeNonNegativeInteger(this int) (interface{}, error) { - return this, nil -} - -// DeserializeNonNegativeInteger creates nonNegativeInteger value from an -// interface representation that has been unmarshalled from a text or binary -// format. -func DeserializeNonNegativeInteger(this interface{}) (int, error) { - if i, ok := this.(float64); ok { - n := int(i) - if n >= 0 { - return n, nil - } else { - return 0, fmt.Errorf("%v is a negative integer for xsd:nonNegativeInteger", this) - } - } else { - return 0, fmt.Errorf("%v cannot be interpreted as a float for xsd:nonNegativeInteger", this) - } -} - -// LessNonNegativeInteger returns true if the left nonNegativeInteger value is -// less than the right value. -func LessNonNegativeInteger(lhs, rhs int) bool { - return lhs < rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/rfc2045/gen_rfc2045.go b/vendor/github.com/go-fed/activity/streams/values/rfc2045/gen_rfc2045.go deleted file mode 100644 index cc28892c0..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/rfc2045/gen_rfc2045.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package rfc2045 - -import "fmt" - -// SerializeRfc2045 converts a rfc2045 value to an interface representation -// suitable for marshalling into a text or binary format. -func SerializeRfc2045(this string) (interface{}, error) { - return this, nil -} - -// DeserializeRfc2045 creates rfc2045 value from an interface representation that -// has been unmarshalled from a text or binary format. -func DeserializeRfc2045(this interface{}) (string, error) { - if s, ok := this.(string); ok { - return s, nil - } else { - return "", fmt.Errorf("%v cannot be interpreted as a string for MIME media type", this) - } -} - -// LessRfc2045 returns true if the left rfc2045 value is less than the right value. -func LessRfc2045(lhs, rhs string) bool { - return lhs < rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/rfc5988/gen_rfc5988.go b/vendor/github.com/go-fed/activity/streams/values/rfc5988/gen_rfc5988.go deleted file mode 100644 index eac2bc247..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/rfc5988/gen_rfc5988.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package rfc5988 - -import "fmt" - -// SerializeRfc5988 converts a rfc5988 value to an interface representation -// suitable for marshalling into a text or binary format. -func SerializeRfc5988(this string) (interface{}, error) { - return this, nil -} - -// DeserializeRfc5988 creates rfc5988 value from an interface representation that -// has been unmarshalled from a text or binary format. -func DeserializeRfc5988(this interface{}) (string, error) { - if s, ok := this.(string); ok { - return s, nil - } else { - return "", fmt.Errorf("%v cannot be interpreted as a string for rel", this) - } -} - -// LessRfc5988 returns true if the left rfc5988 value is less than the right value. -func LessRfc5988(lhs, rhs string) bool { - return lhs < rhs -} diff --git a/vendor/github.com/go-fed/activity/streams/values/string/gen_string.go b/vendor/github.com/go-fed/activity/streams/values/string/gen_string.go deleted file mode 100644 index 23aee678f..000000000 --- a/vendor/github.com/go-fed/activity/streams/values/string/gen_string.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by astool. DO NOT EDIT. - -package string - -import "fmt" - -// SerializeString converts a string value to an interface representation suitable -// for marshalling into a text or binary format. -func SerializeString(this string) (interface{}, error) { - return this, nil -} - -// DeserializeString creates string value from an interface representation that -// has been unmarshalled from a text or binary format. -func DeserializeString(this interface{}) (string, error) { - if s, ok := this.(string); ok { - return s, nil - } else { - return "", fmt.Errorf("%v cannot be interpreted as a string for xsd:string", this) - } -} - -// LessString returns true if the left string value is less than the right value. -func LessString(lhs, rhs string) bool { - return lhs < rhs -} |