Add Sequences to API.
This commit is contained in:
parent
4c1bb758ce
commit
232790b452
@ -164,6 +164,11 @@ func GetConnectionInfo(c *gin.Context) {
|
||||
c.JSON(200, res.Format()[0])
|
||||
}
|
||||
|
||||
func GetSequences(c *gin.Context) {
|
||||
res, err := DbClient.Sequences()
|
||||
serveResult(res, err, c)
|
||||
}
|
||||
|
||||
func GetActivity(c *gin.Context) {
|
||||
res, err := DbClient.Activity()
|
||||
serveResult(res, err, c)
|
||||
|
@ -25,6 +25,7 @@ func SetupRoutes(router *gin.Engine) {
|
||||
api.POST("/connect", Connect)
|
||||
api.GET("/databases", GetDatabases)
|
||||
api.GET("/connection", GetConnectionInfo)
|
||||
api.GET("/sequences", GetSequences)
|
||||
api.GET("/activity", GetActivity)
|
||||
api.GET("/schemas", GetSchemas)
|
||||
api.GET("/tables", GetTables)
|
||||
|
@ -136,6 +136,10 @@ func (client *Client) TableIndexes(table string) (*Result, error) {
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (client *Client) Sequences() ([]string, error) {
|
||||
return client.fetchRows(statements.PG_SEQUENCES)
|
||||
}
|
||||
|
||||
// Returns all active queriers on the server
|
||||
func (client *Client) Activity() (*Result, error) {
|
||||
return client.query(statements.PG_ACTIVITY)
|
||||
|
@ -31,6 +31,8 @@ WHERE table_name = $1`
|
||||
|
||||
PG_TABLES = `SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_schema,table_name`
|
||||
|
||||
PG_SEQUENCES = `SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = 'public' ORDER BY sequence_name`
|
||||
|
||||
PG_ACTIVITY = `SELECT
|
||||
datname,
|
||||
query,
|
||||
|
Loading…
x
Reference in New Issue
Block a user