resqu

command module
v0.0.0-...-1b820a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 15 Imported by: 0

README

resqu Build Status

resqu (RESt from QUeries) helps you to serve database query results as JSON via HTTP.

NOTE: the project is under development, so some breaking changes may happen

Usage

Docker

docker run -v $(pwd)/config.yaml:/resqu/config.yaml pyrooka/resqu

If you want to use docker compose check the examples directory.

Helm

helm upgrade -i resqu ./resqu-helm

Environment variables
  • SERVER_PORT
  • CACHE_TYPE: local or redis
DB configs

Templates you can use:

E.g. config.yaml:

sqlite:
  connection:
    path: /db/employees.sqlite3
  endpoints:
    - url: /employees
      query: SELECT * FROM emp {{if .limit}} LIMIT {{.limit}} {{end}} {{if .offset}} OFFSET {{.offset}} {{end}}
      cache:
        enabled: true
        clearTime: "0 */10 * * * *" # Clear the cache for this URL in every 10 mins. https://github.com/robfig/cron
    - url: /employees/{empNo}
      query: SELECT * FROM emp WHERE empno = {{.empNo}}
      cache:
        enabled: false
SQLite3
sqlite:
  connection:
    path: /db/employees.sqlite3 # path to the DB file
  endpoints: []
PostgreSQL
postgresql:
  connection:
    connectionURL: "postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]"
  endpoints: []
BigQuery
bigquery:
  connection:
    serviceAccPath: /google/sa.json # path to the service account json
    projectId: my-awesome-project # the project ID for the queries
  endpoints: []
API responses
Status code Body
200 {"data": [...]}
400 error message
500 error message

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址