MCPcopy Create free account
hub / github.com/DataDog/jsonapi / checkLinkValue

Function checkLinkValue

jsonapi.go:91–109  ·  view source on GitHub ↗
(linkValue any)

Source from the content-addressed store, hash-verified

89}
90
91func checkLinkValue(linkValue any) (bool, *TypeError) {
92 var isEmpty bool
93
94 switch lv := linkValue.(type) {
95 case *LinkObject:
96 if err := checkMeta(lv.Meta); err != nil {
97 return false, err
98 }
99 isEmpty = (lv.Href == "")
100 case string:
101 isEmpty = (lv == "")
102 case nil:
103 isEmpty = true
104 default:
105 return false, &TypeError{Actual: fmt.Sprintf("%T", lv), Expected: []string{"*LinkObject", "string"}}
106 }
107
108 return isEmpty, nil
109}
110
111func (l *Link) check() error {
112 selfIsEmpty, err := checkLinkValue(l.Self)

Callers 2

checkMethod · 0.85
makeDocumentErrorsFunction · 0.85

Calls 1

checkMetaFunction · 0.85

Tested by

no test coverage detected