MCPcopy Create free account
hub / github.com/bet365/jingo / optInstrEncoder

Method optInstrEncoder

structencoder.go:187–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185}
186
187func (e *StructEncoder) optInstrEncoder() {
188 t := reflect.ValueOf(e.t).Field(e.i).Type()
189 if e.f.Type.Kind() == reflect.Ptr {
190 t = t.Elem()
191 }
192
193 conv := func(v unsafe.Pointer, w *Buffer) {
194 e, ok := reflect.NewAt(t, v).Interface().(JSONEncoder)
195 if !ok {
196 w.Write(null)
197 return
198 }
199 e.JSONEncode(w)
200 }
201
202 if e.f.Type.Kind() == reflect.Ptr {
203 e.ptrval(conv)
204 } else {
205 e.val(conv)
206 }
207}
208
209func (e *StructEncoder) optInstrEncoderWriter() {
210 t := reflect.ValueOf(e.t).Field(e.i).Type()

Callers 1

NewStructEncoderFunction · 0.95

Calls 4

ptrvalMethod · 0.95
valMethod · 0.95
WriteMethod · 0.80
JSONEncodeMethod · 0.65

Tested by

no test coverage detected