pass the dbschema in the context

This commit is contained in:
Alfred Kamanda 2025-01-08 10:57:58 +03:00 committed by konstantinmds
parent b0c9197ce4
commit 7049e02490

View File

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