dbcat

command module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

dbcat

This is a db client, currently support sqlite3.

Connect to sqlite database

dbcat shell -dbPath=<sqlite db path>

# or ignore shell
dbcat -dbPath=<sqlite db path>

Show tables

.tables

# Filter table with pattern
.tables <pattern>

Show schemas

.schema

.schema <pattern>

Show columns

.columns

.columns <table name>

Query data

.query <query sql>

# or just type query sql
<query sql>

Example

$ dbcat -dbPath=test.db
dbcat> create table tbl1(one text, two int);
dbcat> insert into tbl1 values('hello!',10);
dbcat> insert into tbl1 values('goodbye', 20);
dbcat> select * from tbl1;
one             two       
----------      ----------
hello!          10        
goodbye         20        
dbcat> CREATE TABLE tbl2 (
  ...>   f1 varchar(30) primary key,
  ...>   f2 text,
  ...>   f3 real
  ...> );
dbcat> .tables
name      
----------
tbl1      
tbl2      
dbcat> .schema
CREATE TABLE tbl1(one text, two int)

CREATE TABLE tbl2 ( f1 varchar(30) primary key, f2 text, f3 real )

dbcat> .schema tbl1
CREATE TABLE tbl1(one text, two int)

dbcat> .columns tbl2
cid             name            type            notnull         dflt_value      pk        
----------      ----------      ----------      ----------      ----------      ----------
0               f1              varchar(30)     0               <nil>           1         
1               f2              TEXT            0               <nil>           0         
2               f3              REAL            0               <nil>           0         
dbcat> .q

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