Allow reuse of an existing db connection when creating a MySQL Store

This commit is contained in:
DGivney
2022-10-10 16:50:34 +11:00
parent 4e6f1c95ff
commit e5eb169055
3 changed files with 39 additions and 11 deletions

View File

@@ -1,12 +1,18 @@
package mysql
import (
"database/sql"
"fmt"
"time"
)
// Config defines the config for storage.
type Config struct {
// DB Will override ConnectionURI and all other authentication values if used
//
// Optional. Default is nil
Db *sql.DB
// Connection string to use for DB. Will override all other authentication values if used
//
// Optional. Default is ""
@@ -63,6 +69,7 @@ type Config struct {
// ConfigDefault is the default config
var ConfigDefault = Config{
Db: nil,
ConnectionURI: "",
Host: "127.0.0.1",
Port: 3306,