iquery

package module
Version: v0.0.0-...-92b4f69 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: MIT Imports: 6 Imported by: 0

README

iquery

Browser based DB query tool that doesn't require any client drivers to be installed.
Current supported DB drivers are: DB2-iSeries, DB2-Community Edition, MSSQL, MySQL, Postgres, and SQLite.


Installation

  1. Install Docker
  2. Download Image
  3. Configuration
  4. Run
Install Docker

Download, and run, the installer for your platform:

Download Image

Pull the image from Docker Hub.

% docker pull minty/iquery
Configuration

Create a script to start a container from the above image.
The script should hold all the databases you'd like to be able to execute queries against, along with port mapping, theme, and a placeholder query.

The format of the database entries are:

DB_X=NAME|DB_TYPE|HOSTNAME|PORT|DATABASE|USERNAME|PASSWORD

eg.

#!/bin/bash

docker run \
	-it \
	-e "DB_1=       Users|    db2-i |     users.db.com |   446 |       users | maverick homolka |L0v{s@pplE" \
	-e "DB_1=       Users|   db2-ce |     forms.db.com | 50000 |       forms | maverick homolka |L0v{s@pplE" \
	-e "DB_3=Credit Card |    mssql |        cc.db.com |  1433 |          cc | maverick homolka |L0v{s@pplE" \
	-e "DB_3=  Customers |    mysql | customers.db.com |  3306 |   customers | maverick homolka |L0v{s@pplE" \
	-e "DB_4=  Buildings | postgres | buildings.db.com |  5432 |   buildings | maverick homolka |L0v{s@pplE" \
	-e "DB_5=       Cars |   sqlite3|                  |       | /db/test.db |                  |" \
	-e "THEME=vs-dark" \
	-e "PLACEHOLDER=SELECT * FROM SCHEMA.TABLE;" \
	-v "$HOME/tmp/db/:/db/" \
	-p 7777:8080 \
	--rm \
	minty/iquery
Run
  • Execute the script created during the Configuration step
  • Open your browser, and navigate to http://localhost:7777
  • cmd+<enter>, or ctrl+<enter> will execute the query

Building

  1. Start Container
    ./bin/dockit.sh
    
  2. Build the Binary
    (You'll also need to pull 3rd party libs. This can be done with ./bin/goget.sh)
    ./bin/build.sh
    
  3. Create Image
    docker build -t minty/iquery .
    

To debug/test you can modify the ./bin/run.sh script with valid database settings and execute it after step 1. This will start the service and allow you to test through http://localhost:7777.


Notes

Changes have been made to the package: bitbucket.org/phiggins/db2cli to fix a few issues, (mainly DB2 time types)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDriver

func AddDriver(d ...Driver)

func ServersFromEnvironment

func ServersFromEnvironment() map[string]Server

Types

type Column

type Column struct {
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
	Type        string  `json:"type"`
	Default     *string `json:"default"`
	IsNullable  *bool   `json:"isNullable"`
}

type Driver

type Driver interface {
	Name() string
	DriverName() string
	ConnectionString(s Server) string
	Schemas(s Server) ([]string, error)
	Tables(s Server, database string) ([]Table, error)
	Columns(s Server, database, table string) ([]Column, error)
	MapRows(r *sql.Rows, columns, limit int) (Rows, error)
}

type Query

type Query struct {
	Name  string `json:"database"`
	Query string `json:"query"`
	Limit int    `json:"limit"`
}

type Result

type Result struct {
	Columns []string `json:"columns"`
	Rows    Rows     `json:"rows"`
}

type Rows

type Rows [][]interface{}

type Server

type Server struct {
	Driver   Driver
	Hostname string
	Port     int
	Database string
	Username string
	Password string
}

type Servers

type Servers map[string]Server

type Table

type Table struct {
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
}

Source Files

Directories

Path Synopsis
cmd
db2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL