add SQLOFunc type and update SQLO error messages

This commit is contained in:
Elijah Duffy
2025-06-05 14:21:59 -07:00
parent 0b0a23cf55
commit 6129163b84
3 changed files with 5 additions and 2 deletions

3
dbx.go
View File

@@ -10,6 +10,9 @@ import (
// ModuleDBName is the name of the database module. // ModuleDBName is the name of the database module.
const ModuleDBName = "database" const ModuleDBName = "database"
// SQLOFunc is a function that returns a *sql.DB pointer.
type SQLOFunc = func() *sql.DB
// Queryable interface is an SQL driver object that can execute SQL statements // Queryable interface is an SQL driver object that can execute SQL statements
// for Jet. // for Jet.
type Queryable interface { type Queryable interface {

View File

@@ -32,7 +32,7 @@ var (
// SQLO returns the current SQL database handle. // SQLO returns the current SQL database handle.
func SQLO() *sql.DB { func SQLO() *sql.DB {
dbModule.RequireLoaded("dbx.SQLO requires database module") // ensure the module is loaded before accessing the database dbModule.RequireLoaded("dbxm.SQLO requires database module") // ensure the module is loaded before accessing the database
if sqlDB == nil { if sqlDB == nil {
panic("SQL database not initialized") panic("SQL database not initialized")
} }

View File

@@ -32,7 +32,7 @@ var (
// SQLO returns the current SQL database handle. // SQLO returns the current SQL database handle.
func SQLO() *sql.DB { func SQLO() *sql.DB {
dbModule.RequireLoaded("dbx.SQLO requires database module") // ensure the module is loaded before accessing the database dbModule.RequireLoaded("dbxp.SQLO requires database module") // ensure the module is loaded before accessing the database
if sqlDB == nil { if sqlDB == nil {
panic("SQL database not initialized") panic("SQL database not initialized")
} }