mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-15 20:13:06 +03:00
Move table schema query into client
This commit is contained in:
parent
5886f153f4
commit
42f79a7079
2
api.go
2
api.go
@ -79,7 +79,7 @@ func API_GetTables(c *gin.Context) {
|
||||
}
|
||||
|
||||
func API_GetTable(c *gin.Context) {
|
||||
res, err := dbClient.Query(fmt.Sprintf(PG_TABLE_SCHEMA, c.Params.ByName("table")))
|
||||
res, err := dbClient.Table(c.Params.ByName("table"))
|
||||
|
||||
if err != nil {
|
||||
c.JSON(400, NewError(err))
|
||||
|
@ -80,6 +80,10 @@ func (client *Client) Tables() ([]string, error) {
|
||||
return tables, nil
|
||||
}
|
||||
|
||||
func (client *Client) Table(table string) (*Result, error) {
|
||||
return client.Query(fmt.Sprintf(PG_TABLE_SCHEMA, table))
|
||||
}
|
||||
|
||||
func (client *Client) TableIndexes(table string) (*Result, error) {
|
||||
res, err := client.Query(fmt.Sprintf(PG_TABLE_INDEXES, table))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user