Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/girigiribauer/db-cli
`db` command line tools (Docker based) by Golang
https://github.com/girigiribauer/db-cli
Last synced: about 1 month ago
JSON representation
`db` command line tools (Docker based) by Golang
- Host: GitHub
- URL: https://github.com/girigiribauer/db-cli
- Owner: girigiribauer
- License: apache-2.0
- Created: 2016-10-01T12:44:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-02T19:00:46.000Z (almost 8 years ago)
- Last Synced: 2024-06-20T00:37:29.294Z (7 months ago)
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# db-cli
`db` command line tools (Docker based)
Type **only 3 strokes**, you can create Database.
## Installation
### step1. Install Docker
### step2. Install db-cli
If you are developer (case: Linux, MacOS)
$ go get github.com/girigiribauer/db-cli
$ cd $GOPATH/src/github.com/girigiribauer/db-cli/cmd/db
$ go install
or Homebrew (case: MacOS)
$ brew tap girigiribauer/db-cli
$ brew install db-cli
If you are end-user, you can download release binaries.
### step3. Check
$ db -h
## Basic usage
### Create
$ db
You can create MariaDB Database (Docker Container).
Maybe container name is "db0", port number is 3306.
These are **automatic assignment.**
### Delete
$ db -d
You can delete this database.
### dump
$ db -o
You can get dump file on "~/db0.sql"
### restore
$ db --file=~/db0.sql
You can restore database with dump file.
### help
$ db -h
or
$ db --help
## Options
see `db -h`
--name CONTAINER_NAME, -n CONTAINER_NAME
override CONTAINER_NAME, auto increment with prefix (default: db0, db1 ...)
--dbname DB_NAME, -b DB_NAME
override DB_NAME (default: "db") [$DBCLI_DB_NAME]
--dbuser DB_USER, -u DB_USER
override DB_USER (default: "db") [$DBCLI_DB_USER]
--dbpass DB_PASS, -p DB_PASS
override DB_PASS (default: "db") [$DBCLI_DB_PASS]
--image DOCKER_IMAGE, -i DOCKER_IMAGE
override DOCKER_IMAGE (default: "mariadb") [$DBCLI_DOCKER_IMAGE]
--tag DOCKER_IMAGE_TAG, -t DOCKER_IMAGE_TAG
override docker image DOCKER_IMAGE_TAG (default: "latest")
-d
delete one container db0, db1 ... (auto incrementation)
--delete CONTAINER_NAME
delete container CONTAINER_NAME
--delete-all
delete all db containers (without use docker command directly)
-o
output dump file in default directory (default: "~/[CONTAINER_NAME].sql")
--dump FILE_PATH
output dump file FILE_PATH
--file FILE_PATH, -f FILE_PATH
restore with file FILE_PATH
--list
list all db containers (without use docker command directly)
## Environment
You can set .bashrc, .zshrc or the other.
DBCLI_CONTAINER_MAX
default: 100 (db0, db1 ... db99)
DBCLI_CONTAINER_PREFIX
default: "db"
DBCLI_DB_NAME
default: "db"
DBCLI_DB_USER
default: "db"
DBCLI_DB_PASS
default: "db"
DBCLI_DOCKER_IMAGE
default: "mariadb"
DBCLI_DIRECTORY
default: "~/"
## soon...
* add PostgreSQL driver