MCPcopy
hub / github.com/pocketbase/pocketbase / TableColumns

Method TableColumns

core/db_table.go:11–19  ·  view source on GitHub ↗

TableColumns returns all column names of a single table by its name.

(tableName string)

Source from the content-addressed store, hash-verified

9
10// TableColumns returns all column names of a single table by its name.
11func (app *BaseApp) TableColumns(tableName string) ([]string, error) {
12 columns := []string{}
13
14 err := app.ConcurrentDB().NewQuery("SELECT name FROM PRAGMA_TABLE_INFO({:tableName})").
15 Bind(dbx.Params{"tableName": tableName}).
16 Column(&columns)
17
18 return columns, err
19}
20
21type TableInfoRow struct {
22 // the `db:"pk"` tag has special semantic so we cannot rename

Callers

nothing calls this directly

Calls 3

ConcurrentDBMethod · 0.95
NewQueryMethod · 0.80
BindMethod · 0.45

Tested by

no test coverage detected