Move table schema query into client

This commit is contained in:
Chris Bandy 2014-10-16 02:54:40 +00:00
parent 5886f153f4
commit 42f79a7079
2 changed files with 5 additions and 1 deletions

2
api.go
View File

@ -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))

View File

@ -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))