Documentation
¶
Overview ¶
Package db is responsible for any database querying
The db package provides a set of exported functions that returns formatted database outputs that are usable in the other packages
Index ¶
- func CloseDB(db *sql.DB)
- func GetColumnMap(db *sql.DB, tableName string) map[string]string
- func GetInverseRelationships(db *sql.DB) map[string]map[string]bool
- func GetRawColumnMap(db *sql.DB, tableName string) map[string]*sql.ColumnType
- func GetRelationships(db *sql.DB) map[string]map[string]map[string]string
- func GetTableMap(db *sql.DB) map[string]int
- func GetTablePKMap(db *sql.DB) map[string][]string
- func InitDB(connString string) (*sql.DB, error)
- func RunQueries(db *sql.DB, queries []string) error
- func RunQueriesVerbose(db *sql.DB, queries []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetColumnMap ¶
GetColumnMap returns a map of column names mapped to their "translated" string type
func GetInverseRelationships ¶
GetInverseRelationships returns a map relating tables to tables that relate to them. It's the same data as the `GetRelationship()` map but formatted differently
func GetRawColumnMap ¶
GetRawColumnMap returns a map of column names mapped to their string type
func GetRelationships ¶
GetRelationships returns a map relating tables to each other via their columns. Format: {table1: {FKColumn: {"Table: table2, "Column": "table2_Col"}}}
func GetTableMap ¶
GetTableMap returns a map of existing table names mapped to the number 1 in the given database
func GetTablePKMap ¶
GetTablePKMap returns a map of table names mapped to an array of string primary keys
func InitDB ¶
InitDB takes in a connection string and returns a database connection alongside any errors that occur
func RunQueries ¶
RunQueries runs a given list of queries and returns any errors the moment they happen
Types ¶
This section is empty.