repository

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CoreDB Global CoreDB Connection
	CoreDB = &Instance{}

	// CoinbaseDB Global CoreDB Connection
	CoinbaseDB = &Instance{}

	// TDAmeritradeDB Global CoreDB Connection
	TDAmeritradeDB = &Instance{}
)

Functions

This section is empty.

Types

type CoreDatabase

type CoreDatabase struct {
	*Instance
}

func (*CoreDatabase) GetUserByUsername

func (db *CoreDatabase) GetUserByUsername(username string) (*models.User, error)

type Instance

type Instance struct {
	SQL *sql.DB
	// contains filtered or unexported fields
}

Instance holds all information for a single database instance

func (*Instance) CloseConnection

func (i *Instance) CloseConnection() error

CloseConnection safely disconnects the global database instance

func (*Instance) GetConfig

func (i *Instance) GetConfig() *InstanceConfig

GetConfig safely returns a copy of the config

func (*Instance) GetSQL

func (i *Instance) GetSQL() (*sql.DB, error)

GetSQL returns the sql connection

func (*Instance) IsConnected

func (i *Instance) IsConnected() bool

IsConnected safely checks the SQL connection status

func (*Instance) Ping

func (i *Instance) Ping() error

Ping pings the database

func (*Instance) SetConfig

func (i *Instance) SetConfig(cfg *InstanceConfig) error

SetConfig safely sets the global database instance's config

func (*Instance) SetConnected

func (i *Instance) SetConnected(v bool)

SetConnected safely sets the global database instance's connected status

func (*Instance) SetMySQLConnection

func (i *Instance) SetMySQLConnection(con *sql.DB) error

SetMySQLConnection safely sets the global database instance's connection to use SQLite

func (*Instance) SetPostgresConnection

func (i *Instance) SetPostgresConnection(con *sql.DB) error

SetPostgresConnection safely sets the global database instance's connection to use Postgres

func (*Instance) SetSQLiteConnection

func (i *Instance) SetSQLiteConnection(con *sql.DB) error

SetSQLiteConnection safely sets the global database instance's connection to use SQLite

type InstanceConfig

type InstanceConfig struct {
	Enabled   bool
	Verbose   bool
	Driver    string
	ConfigDir string
	DSN       *drivers.ConnectionDetails
}

Jump to

Keyboard shortcuts

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