MCPcopy Create free account
hub / github.com/dolanor/rip / decodeIn

Function decodeIn

handler.go:137–145  ·  view source on GitHub ↗

decodeIn use the content type to decode the data from r into t (which should be a pointer).

(t any, r io.Reader, contentType string, options *RouteOptions)

Source from the content-addressed store, hash-verified

135
136// decodeIn use the content type to decode the data from r into t (which should be a pointer).
137func decodeIn(t any, r io.Reader, contentType string, options *RouteOptions) (any, error) {
138 decoder, err := encoding.ContentTypeDecoder(r, contentType, options.codecs)
139 if err != nil {
140 return t, err
141 }
142
143 err = decoder.Decode(t)
144 return t, err
145}
146
147// TODO: is it used? Delete?
148func updateFieldInEntity[Ent any](entity Ent, fieldName string, fieldValue any) (err error) {

Callers

nothing calls this directly

Calls 2

ContentTypeDecoderFunction · 0.92
DecodeMethod · 0.65

Tested by

no test coverage detected