Skip to content

Latest commit

 

History

History

database

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

GoCryptoTrader package Database

Build Status Software License GoDoc Coverage Status Go Report Card

This database package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Current Features for database package

  • Establishes & Maintains database connection across program life cycle
  • Multiple database support via simple repository model
  • Run migration on connection to assure database is at correct version

How to use

To Manually migrate to the latest database you can run the "dbmigrate" helper in the cmd folder

This will parse and run all migration files in your $GoCryptoTrader/database/migrations

This is also run from the bot when a connection is established to the database

go run ./cmd/dbmigrate

A Makefile command has also been added for this

make db_migrate
To create a new migrate file you can also run the same command with the -create "migration name" flag
go run ./cmd/dbmigrate -create "alter some table"
Adding a new model
  • Create Model in github.com/thrasher-corp/gocryptotrader/database/models directory
Adding a Repository
  • Create Repository directory in github.com/thrasher-corp/gocryptotrader/database/repository/
  • Create a base Repository interface with any required Methods
  • Create a per driver implementation of the Repository that implement all required methods to match the interface

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB