database

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DBSQLite const string for sqlite across code base
	DBSQLite = "sqlite"

	// DBPostgreSQL const string for PostgreSQL across code base
	DBPostgreSQL = "postgres"

	// DBMySQL const string for MySQL across code base
	DBMySQL = "mysql"

	// 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 {
	CoreConn *ConnectionDetails
}

Config holds information for all databases

func NewConfig

func NewConfig() *Config

NewConfig Generate default settings for the Config struct

type ConnectionDetails

type ConnectionDetails struct {
	Driver   string
	Host     string
	Port     uint16
	Username string
	Password string
	Database string
	SSLMode  string
}

ConnectionDetails holds DSN information for a single database connection

type Database

type Database struct {
	*service.Service
	*Config
}

func NewDatabase

func NewDatabase(config *Config) (*Database, error)

func (*Database) Start

func (db *Database) Start(group *sync.WaitGroup)

Start spawns the main process done by the service.

func (*Database) Stop

func (db *Database) Stop() error

Stop terminates all processes belonging to the service, blocking until they are all terminated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL