MCPcopy Create free account
hub / github.com/oschwald/maxminddb-golang / cachedFieldsForTypeWithStack

Function cachedFieldsForTypeWithStack

internal/decoder/reflection.go:1268–1290  ·  view source on GitHub ↗
(
	resultType reflect.Type,
	stack map[reflect.Type]bool,
)

Source from the content-addressed store, hash-verified

1266}
1267
1268func cachedFieldsForTypeWithStack(
1269 resultType reflect.Type,
1270 stack map[reflect.Type]bool,
1271) *fieldsType {
1272 if fields, ok := fieldsMap.Load(resultType); ok {
1273 return fields.(*fieldsType)
1274 }
1275
1276 if stack != nil && stack[resultType] {
1277 return nil
1278 }
1279
1280 nextStack := make(map[reflect.Type]bool, len(stack)+1)
1281 for typ := range stack {
1282 nextStack[typ] = true
1283 }
1284 nextStack[resultType] = true
1285
1286 fields := makeStructFieldsWithStack(resultType, nextStack)
1287 actual, _ := fieldsMap.LoadOrStore(resultType, fields)
1288
1289 return actual.(*fieldsType)
1290}
1291
1292// makeStructFields implements json/v2 style field precedence rules.
1293func makeStructFields(rootType reflect.Type) *fieldsType {

Callers 2

cachedFieldsForTypeFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…