(schema: SchemaDef)
| 35 | const schemaLookupCache = new WeakMap<SchemaDef, SchemaLookupCache>(); |
| 36 | |
| 37 | function getSchemaLookupCache(schema: SchemaDef): SchemaLookupCache { |
| 38 | let cache = schemaLookupCache.get(schema); |
| 39 | if (!cache) { |
| 40 | cache = { model: new Map(), m2mRelation: new Map() }; |
| 41 | schemaLookupCache.set(schema, cache); |
| 42 | } |
| 43 | return cache; |
| 44 | } |
| 45 | |
| 46 | export function getModel(schema: SchemaDef, model: string) { |
| 47 | const cache = getSchemaLookupCache(schema); |
no outgoing calls
no test coverage detected