MCPcopy Create free account
hub / github.com/openclaw/gogcli / findJSONField

Function findJSONField

internal/sheetsformat/format.go:222–246  ·  view source on GitHub ↗
(v reflect.Value, jsonName string)

Source from the content-addressed store, hash-verified

220}
221
222func findJSONField(v reflect.Value, jsonName string) (reflect.Value, string, bool) {
223 t := v.Type()
224 for i := 0; i < t.NumField(); i++ {
225 field := t.Field(i)
226 if field.PkgPath != "" {
227 continue
228 }
229
230 tag := field.Tag.Get("json")
231 if tag == "-" {
232 continue
233 }
234
235 name := strings.Split(tag, ",")[0]
236 if name == "" {
237 continue
238 }
239
240 if name == jsonName {
241 return v.Field(i), field.Name, true
242 }
243 }
244
245 return reflect.Value{}, "", false
246}
247
248func addForceSendField(v reflect.Value, fieldName string) error {
249 forceSendFields := v.FieldByName("ForceSendFields")

Callers 1

resolveJSONFieldFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected