pass the dbschema in the context

This commit is contained in:
Alfred Kamanda 2025-01-08 10:57:58 +03:00
parent f59c3a53ef
commit a37f6e6da3
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703

View File

@ -24,6 +24,7 @@ var (
logg = logging.NewVanilla() logg = logging.NewVanilla()
scriptDir = path.Join(baseDir, "services", "registration") scriptDir = path.Join(baseDir, "services", "registration")
selectedDatabase = "" selectedDatabase = ""
selectedDbSchema = ""
) )
func init() { func init() {
@ -31,14 +32,17 @@ func init() {
} }
// SetDatabase updates the database used by TestEngine // SetDatabase updates the database used by TestEngine
func SetDatabase(dbType string) { func SetDatabase(dbType string, dbSchema string) {
selectedDatabase = dbType selectedDatabase = dbType
selectedDbSchema = dbSchema
} }
func TestEngine(sessionId string) (engine.Engine, func(), chan bool) { func TestEngine(sessionId string) (engine.Engine, func(), chan bool) {
ctx := context.Background() ctx := context.Background()
ctx = context.WithValue(ctx, "SessionId", sessionId) ctx = context.WithValue(ctx, "SessionId", sessionId)
ctx = context.WithValue(ctx, "Database", selectedDatabase) ctx = context.WithValue(ctx, "Database", selectedDatabase)
ctx = context.WithValue(ctx, "Schema", selectedDbSchema)
pfp := path.Join(scriptDir, "pp.csv") pfp := path.Join(scriptDir, "pp.csv")
var eventChannel = make(chan bool) var eventChannel = make(chan bool)