Add a database instance without using connection details

This commit is contained in:
Magnus Åhall 2025-09-18 19:45:29 +02:00
parent b83c7b1e17
commit 825cf0fc9a
2 changed files with 8 additions and 0 deletions

View file

@ -16,6 +16,10 @@ func newDatabase(host string, port int, dbName, user, pass string) (dbase Databa
dbase.db, err = sql.Open("postgres", dbase.sqlConnString())
return
}// }}}
func databaseFromInstance(db *sql.DB) (dbase Database, err error) {
dbase.db = db
return
}
func (dbase Database) sqlConnString() string {// {{{
return fmt.Sprintf(