From 6129163b84e1da92305656b78c6b2568dd879076 Mon Sep 17 00:00:00 2001 From: Elijah Duffy Date: Thu, 5 Jun 2025 14:21:59 -0700 Subject: [PATCH] add SQLOFunc type and update SQLO error messages --- dbx.go | 3 +++ dbxm/mysql.go | 2 +- dbxp/pxg.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dbx.go b/dbx.go index 3ffb86b..906c41a 100644 --- a/dbx.go +++ b/dbx.go @@ -10,6 +10,9 @@ import ( // ModuleDBName is the name of the database module. 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 // for Jet. type Queryable interface { diff --git a/dbxm/mysql.go b/dbxm/mysql.go index 3eb53bb..b2dc62e 100644 --- a/dbxm/mysql.go +++ b/dbxm/mysql.go @@ -32,7 +32,7 @@ var ( // SQLO returns the current SQL database handle. 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 { panic("SQL database not initialized") } diff --git a/dbxp/pxg.go b/dbxp/pxg.go index 084382e..6e63e06 100644 --- a/dbxp/pxg.go +++ b/dbxp/pxg.go @@ -32,7 +32,7 @@ var ( // SQLO returns the current SQL database handle. 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 { panic("SQL database not initialized") }