MCPcopy
hub / github.com/pocketbase/pocketbase / ExpandRecords

Method ExpandRecords

core/record_query_expand.go:34–46  ·  view source on GitHub ↗

ExpandRecords expands the relations of the provided Record models list. If optFetchFunc is not set, then a default function will be used that returns all relation records. Returns a map with the failed expand parameters and their errors.

(records []*Record, expands []string, optFetchFunc ExpandFetchFunc)

Source from the content-addressed store, hash-verified

32//
33// Returns a map with the failed expand parameters and their errors.
34func (app *BaseApp) ExpandRecords(records []*Record, expands []string, optFetchFunc ExpandFetchFunc) map[string]error {
35 normalized := normalizeExpands(expands)
36
37 failed := map[string]error{}
38
39 for _, expand := range normalized {
40 if err := app.expandRecords(records, expand, optFetchFunc, 1); err != nil {
41 failed[expand] = err
42 }
43 }
44
45 return failed
46}
47
48// Deprecated
49var indirectExpandRegexOld = regexp.MustCompile(`^(\w+)\((\w+)\)$`)

Callers 1

ExpandRecordMethod · 0.95

Calls 2

expandRecordsMethod · 0.95
normalizeExpandsFunction · 0.85

Tested by

no test coverage detected