Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultCoreDatabase const string for name of core database (sqlite filename) DefaultCoreDatabase = "qst.db" // DefaultCoinbaseDatabase const string for name of coinbase database (sqlite filename) DefaultCoinbaseDatabase = "qst_coinbase.db" // DefaultTDAmeritradeDatabase const string for name of td-ameritrade database (sqlite filename) DefaultTDAmeritradeDatabase = "qst_tdameritrade.db" // DefaultHost the default host to use to connect to the database DefaultHost = "127.0.0.1" // DefaultPort the default port to use to connect to the database DefaultPort = 3306 // DefaultUsername the default username to use when first creating the database DefaultUsername = "qst" // DefaultPassword the default password to use when first creating the database DefaultPassword = "qu4n75t0pt3rm1nal1s4w3s0m3!" // DefaultSSLMode default ssl mode is off DefaultSSLMode = "false" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { CoreConfig *repository.InstanceConfig CoinbaseConfig *repository.InstanceConfig TDAmeritradeConfig *repository.InstanceConfig }
Config holds information for all databases
type Database ¶
type Database struct { *Config *service.Service CoreDB *repository.CoreDatabase CoinbaseDB *repository.Instance TDAmeritradeDB *repository.Instance }
func NewDatabase ¶
NewDatabase creates the database connections
func (*Database) CheckConnection ¶ added in v0.3.0
CheckConnection checks to make sure the database is connected
func (*Database) Run ¶ added in v0.3.0
Run is the main thread of the process, called as a goroutine.
type IDatabase ¶ added in v0.3.0
type IDatabase interface { IsConnected() bool GetSQL() (*sql.DB, error) GetConfig() *repository.InstanceConfig }
IDatabase allows for the passing of a database struct without giving the receiver access to all functionality
type ISQL ¶ added in v0.3.0
type ISQL interface { BeginTx(context.Context, *sql.TxOptions) (*sql.Tx, error) Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row ExecContext(context.Context, string, ...interface{}) (sql.Result, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row }
ISQL allows for the passing of an SQL connection without giving the receiver access to all functionality
Click to show internal directories.
Click to hide internal directories.