Skip to content
/ qp Public

Printer that prints the results of a query to the database.

License

Notifications You must be signed in to change notification settings

k1LoW/qp

Repository files navigation

qp

Printer that prints the results of a query to the database.

Usage

package main

import (
	"database/sql"
	"log"

	"github.com/k1LoW/qp"
	_ "github.com/mattn/go-sqlite3"
)

func main() {
	db, err := sql.Open("sqlite3", "path/to/db")
	if err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	qp.Print(db, "SELECT * FROM users WHERE username = 'alice'")
}
$ go run main.go
+----+----------+----------+-------------------+---------------------+---------+
| id | username | password |       email       |       created       | updated |
+----+----------+----------+-------------------+---------------------+---------+
|  1 | alice    | passw0rd | alice@example.com | 2017-12-05 00:00:00 | <nil>   |
+----+----------+----------+-------------------+---------------------+---------+
(1 row)

About

Printer that prints the results of a query to the database.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published