ek9_query_records
Answers first: status, recordCount, recordNames - complete for the workspace or the filters given - then records[] {name, module, file, line, fields, extends, traits, isOpen}.
When to use it
'Which records exist, and is there a data shape to reuse' is one call - no arguments, or nameFilter / fieldNameFilter / moduleFilter to narrow.
When not to use it
- constructs with methods/behaviour, not just data (use
ek9_query_classes) - interface contracts (use
ek9_query_traits) - constrained primitive types, EmailAddress as String (use
ek9_query_constrained_types) - a record you already know the name of (
ek9_query_referencesfor its usage sites,ek9_read_constructfor its full source)
Details
Each record carries name, module, file (workspace-relative), line, fields[] (name+type; unresolved types render <unresolved>), extends (null unless a super declared; implicit Any filtered), traits[], isOpen. Only directly-declared fields — supers not flattened; nameFilter and fieldNameFilter are plain case-insensitive substrings, never regex. status:empty (not an error) when nothing matched or moduleFilter named non-existent modules — then meta.unmatchedFilters[] carries module:<value>.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
fieldNameFilter | string | Filter to records declaring a field whose name matches (case-insensitive substring). | |
moduleFilter | array of string | Restrict to specific modules (exact names). Default: workspace-wide. | |
nameFilter | string | Case-insensitive substring match on record names. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
List all
Request
{ }
Response
{
"meta" : {
"serverMs" : "<timing>"
},
"recordCount" : 2,
"recordNames" : [ "PostalAddress", "Amount" ],
"records" : [ {
"extends" : null,
"fields" : [ {
"name" : "line1",
"type" : "String"
}, {
"name" : "city",
"type" : "String"
}, {
"name" : "postCode",
"type" : "String"
} ],
"file" : "shapes.ek9",
"isOpen" : false,
"line" : 6,
"module" : "com.example.shapes",
"name" : "PostalAddress",
"traits" : [ ]
...
Cut short here: 21 more lines. The whole recorded call.