sqltool

command module
v0.0.0-...-fe6aa09 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Unlicense Imports: 5 Imported by: 0

README

MAKE SQL QUERIES RIGHT FROM YOUR TERMINAL!!!

the plan:

- compile this program
- set the DATABASE_URL envvar to your postgresql db's connection string.
  example in fish shell:
	set -xg DATABASE_URL 'postgresql://localhost:5432/public'
- rename the compiled program to the needed sql command 
  like “select”, “update”, “drop”, “alter”, etc...
- put it to the any place where your shell will find it.
- ???
- PROFIT!

works only with postgres because it uses pgx. 
errors are going to stderr, ‘\t’ separated table data with the header goes to stdout.

here's the example of how to calculate the number of rows in the table:

	~/ select "*" from test_numeric | sed 1d | wc
		5	15	108

i suggest you to put those commands into /opt/sql directory.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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