pgweb/README.md

82 lines
898 B
Markdown
Raw Normal View History

2014-10-08 21:29:43 -05:00
# pgweb
Experiments with PostgreSQL and GO
## Usage
CLI options:
```
-h, --host= Server hostname or IP (localhost)
-p, --port= Server port (5432)
-u, --user= Database user (postgres)
-d, --db= Database name (postgres)
```
2014-10-08 21:54:49 -05:00
## Compile
Go 1.3+ is required. To complire source execute:
```
2014-10-08 21:55:15 -05:00
go get
2014-10-08 21:54:49 -05:00
go build
```
2014-10-08 21:55:43 -05:00
This will produce `pgweb` binary in the current workdir.
2014-10-08 21:54:49 -05:00
2014-10-08 21:29:43 -05:00
## API
2014-10-09 10:00:30 -05:00
Get databases:
```
GET /databases
```
Get current database tables:
2014-10-08 21:29:43 -05:00
```
GET /tables
```
2014-10-09 19:23:19 -05:00
Get table details:
```
GET /tables/:name
```
2014-10-08 21:29:43 -05:00
Execute select query:
```
2014-10-09 19:23:19 -05:00
POST /select?query=SQL
GET /select?query=SQL
```
### Response formats
Successful response:
```json
{
"columns": [
"column_name1",
"column_name2",
"column_name3"
],
"rows": [
[
"column 1 value",
"column 2 value",
"column 3 value"
]
]
}
```
Error response:
```json
{
"error": "Error message"
}
```