MCPcopy
hub / github.com/pocketbase/pocketbase / getQueryTableInfo

Function getQueryTableInfo

core/view.go:522–545  ·  view source on GitHub ↗
(app App, selectQuery string)

Source from the content-addressed store, hash-verified

520}
521
522func getQueryTableInfo(app App, selectQuery string) ([]*TableInfoRow, error) {
523 tempView := "_temp_" + security.PseudorandomString(6)
524
525 var info []*TableInfoRow
526
527 txErr := app.RunInTransaction(func(txApp App) error {
528 // create a temp view with the provided query
529 err := txApp.SaveView(tempView, selectQuery)
530 if err != nil {
531 return err
532 }
533
534 // extract the generated view table info
535 info, err = txApp.TableInfo(tempView)
536
537 return errors.Join(err, txApp.DeleteView(tempView))
538 })
539
540 if txErr != nil {
541 return nil, txErr
542 }
543
544 return info, nil
545}
546
547// -------------------------------------------------------------------
548// Raw query identifiers parser

Callers 2

normalizeViewQueryIdFunction · 0.85
CreateViewFieldsMethod · 0.85

Calls 5

PseudorandomStringFunction · 0.92
RunInTransactionMethod · 0.65
SaveViewMethod · 0.65
TableInfoMethod · 0.65
DeleteViewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…