README
This commit is contained in:
49
API.md
Normal file
49
API.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
## API
|
||||||
|
|
||||||
|
Get current database tables:
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /tables
|
||||||
|
```
|
||||||
|
|
||||||
|
Get table details:
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /tables/:name
|
||||||
|
```
|
||||||
|
|
||||||
|
Execute select query:
|
||||||
|
|
||||||
|
```
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
```
|
||||||
66
README.md
66
README.md
@@ -1,6 +1,6 @@
|
|||||||
# pgweb
|
# pgweb
|
||||||
|
|
||||||
Experiments with PostgreSQL and GO
|
Web-based PostgreSQL database browser written in Go.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -11,65 +11,23 @@ CLI options:
|
|||||||
-p, --port= Server port (5432)
|
-p, --port= Server port (5432)
|
||||||
-u, --user= Database user (postgres)
|
-u, --user= Database user (postgres)
|
||||||
-d, --db= Database name (postgres)
|
-d, --db= Database name (postgres)
|
||||||
|
--url= Database connection string (postgresql://...)
|
||||||
|
--ssl= SSL option (disable)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Compile
|
## Compile from source
|
||||||
|
|
||||||
Go 1.3+ is required. To complire source execute:
|
Go 1.3+ is required. You can install Go with `homebrew`:
|
||||||
|
|
||||||
|
```
|
||||||
|
brew install go
|
||||||
|
```
|
||||||
|
|
||||||
|
To compile source code run the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
go get
|
go get
|
||||||
go build
|
go build
|
||||||
```
|
```
|
||||||
|
|
||||||
This will produce `pgweb` binary in the current workdir.
|
This will produce `pgweb` binary in the current directory.
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
Get current database tables:
|
|
||||||
|
|
||||||
```
|
|
||||||
GET /tables
|
|
||||||
```
|
|
||||||
|
|
||||||
Get table details:
|
|
||||||
|
|
||||||
```
|
|
||||||
GET /tables/:name
|
|
||||||
```
|
|
||||||
|
|
||||||
Execute select query:
|
|
||||||
|
|
||||||
```
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Reference in New Issue
Block a user