GOKE

A simple and useful CLI used for database management

Descritpion

Goke is a CLI used for database management. It is written in Go and uses the SQL syntax. It is a simple and useful tool for database management, a simple command and migrate your SQL schema easily.

How to use

  • Clone the repository
  • Run go build to build the project

OR

  • Download the binary file from the release page
    • Create a path to the binary file
  • Running the binary file

#Windows

export ${NAME}=${PATH_TO_BIN}
#Linux

export ${NAME}=${PATH_TO_BIN}
#Mac

export ${NAME}=${PATH_TO_BIN}

Features

  • Create tables
  • Create a database
  • Drop tables
  • Migration history for dropped tables
  • Migration history for created tables
  • Dump tables to a json file
  • Dump tables to a csv file
  • Loads data from a json file
  • Loads data from a csv file

Supported databases

  • SQLite3
  • MySQL
  • PostgreSQL
  • MariaDB
  • SQL server

Unsupported databases

  • NoSQL databases

Examples

  • MYSQL
  • POSTGRESQL
  • SQLITE3
  • MARIADB (Not supported yet)
  • SQL SERVER (Not supported yet)

Note: Docker is required to run the examples, otherwise you can run the examples directly on your machine or run the SQLITE3 example.

Running database Drivers

  • docker file contains the following database drivers
  1. MYSQL
  2. POSTGRESQL
  3. MARIADB
$ docker-compose up -d

Running Goke CLI

$ goke # check if the path is set

#Full command

$ goke --help # To see the help
$ goke --version # To see the version
$ goke --init # Initialize goke in the current directory

#Shorthand
$ goke -h # To see the help
$ goke -v # To see the version
$ goke -i # Initialize goke in the current directory

Will create a file called goke-config.yaml in the current directory with the following content

# Default mysql driver configuration
username: root
password: root
dialect: mysql
sslmode: disable
dbname: Goke_test
host: localhost
port: 3306

Testing connection with the database

$ goke test 

Creating a table

#No args
$ goke migrate 
#Full command
$ goke migrate --name ${MIGRATION_NAME} 
#Shorthand
$ goke migrate -n ${MIGRATION_NAME}

Response 
"successfully created table file name start's with ${FILE_NAME} at ${DATE_TIME}"

Dropping a table

#Full command
$ goke drop --table ${TABLE_NAME} 
#Shorthand
$ goke drop -t ${TABLE_NAME}

Response 
"successfully dropped table ${TABLE_NAME} at ${DATE_TIME}"

Release

License

MIT

  • Feel free to contribute to the project and make “your version” 😁

GitHub

View Github