Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nadoo/reportd
generate html/json report from configurable sql string.
https://github.com/nadoo/reportd
Last synced: 5 days ago
JSON representation
generate html/json report from configurable sql string.
- Host: GitHub
- URL: https://github.com/nadoo/reportd
- Owner: nadoo
- License: mit
- Created: 2015-08-25T14:21:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-04T04:30:45.000Z (over 6 years ago)
- Last Synced: 2024-11-07T16:30:32.628Z (about 2 months ago)
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
reportd
=====An easy report server for generate html or json from database.
## Install
go get -u github.com/nadoo/reportd
## Build
cd $GOPATH/src/github.com/nadoo/reportd
go build## Config
# Listen Address: "ip:port" OR ":port"(listen on all interfaces)
Listen = ":8080"# Database Type: "mysql" OR "postgres"
DBType = "mysql"# Database connection string
DBConn = "user:password@tcp(127.0.0.1:3306)/database?charset=utf8&autocommit=true" # mysql
#DBConn = "postgres://user:[email protected]:5432/database?sslmode=disable" # postgres[[Reports]]
Title = "Report 1"
Sql = """SELECT
s.song_id AS SongID
,s.song_name
FROM m_song s
LIMIT 1;
"""[[Reports]]
Title = "Report 2"
Params = true
Sql = """SELECT
s.song_id,
s.song_name
FROM m_song s
WHERE s.song_artist_only IN (:artists);
"""#[[Reports]]
#Title = "Report 3"
#Params = true
#Sql = """SELECT
# s.song_id,
# s.song_name
# FROM m_song s
# WHERE s.song_artist_only = :artist1 OR s.song_artist_only = :artist2;
#"""## Usage
1. Run the program:
> nohup ./reportd &2. View in the browser:
- html output:
> http://127.0.0.1:8080
- html output with query parameters:
> http://127.0.0.1:8080?artists=she&artists=her
- json output:
> http://127.0.0.1:8080/json
- json output with query parameters:
> http://127.0.0.1:8080/json?artists=she&artists=her