MCPcopy
hub / github.com/pocketbase/pocketbase / findCollectionsByIdentifiers

Function findCollectionsByIdentifiers

core/view.go:487–520  ·  view source on GitHub ↗
(app App, tables []identifier)

Source from the content-addressed store, hash-verified

485}
486
487func findCollectionsByIdentifiers(app App, tables []identifier) (map[string]*Collection, error) {
488 names := make([]any, 0, len(tables))
489
490 for _, table := range tables {
491 if strings.Contains(table.alias, "(") {
492 continue // skip expressions
493 }
494 names = append(names, table.original)
495 }
496
497 if len(names) == 0 {
498 return nil, nil
499 }
500
501 result := make(map[string]*Collection, len(names))
502 collections := make([]*Collection, 0, len(names))
503
504 err := app.CollectionQuery().
505 AndWhere(dbx.In("name", names...)).
506 All(&collections)
507 if err != nil {
508 return nil, err
509 }
510
511 for _, table := range tables {
512 for _, collection := range collections {
513 if collection.Name == table.original {
514 result[table.alias] = collection
515 }
516 }
517 }
518
519 return result, nil
520}
521
522func getQueryTableInfo(app App, selectQuery string) ([]*TableInfoRow, error) {
523 tempView := "_temp_" + security.PseudorandomString(6)

Callers 1

parseQueryToFieldsFunction · 0.85

Calls 1

CollectionQueryMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…