Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
latolukasz committed Sep 1, 2021
1 parent 26945a0 commit 7f5c382
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions background_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,37 @@ func (r *BackgroundConsumer) handleLazy(event Event) {
}

func (r *BackgroundConsumer) handleQueries(engine *Engine, validMap map[string]interface{}) []uint64 {
queries := validMap["q"]
validQueries := queries.([]interface{})
ids := make([]uint64, len(validQueries))
for i, query := range validQueries {
validInsert := query.([]interface{})
code := validInsert[0].(string)
db := engine.GetMysql(code)
sql := validInsert[1].(string)
res := db.Exec(sql)
if sql[0:11] == "INSERT INTO" {
id := res.LastInsertId()
ids[i] = res.LastInsertId()
logEvents, has := validMap["l"]
if has {
for _, row := range logEvents.([]interface{}) {
row.(map[interface{}]interface{})["ID"] = id
id += db.GetPoolConfig().getAutoincrement()
queries, has := validMap["q"]
var ids []uint64
if has {
validQueries := queries.([]interface{})
ids = make([]uint64, len(validQueries))
for i, query := range validQueries {
validInsert := query.([]interface{})
code := validInsert[0].(string)
db := engine.GetMysql(code)
sql := validInsert[1].(string)
res := db.Exec(sql)
if sql[0:11] == "INSERT INTO" {
id := res.LastInsertId()
ids[i] = res.LastInsertId()
logEvents, has := validMap["l"]
if has {
for _, row := range logEvents.([]interface{}) {
row.(map[interface{}]interface{})["ID"] = id
id += db.GetPoolConfig().getAutoincrement()
}
}
}
dirtyEvents, has := validMap["d"]
if has {
for _, row := range dirtyEvents.([]interface{}) {
row.(map[interface{}]interface{})["Event"].(map[interface{}]interface{})["I"] = id
id += db.GetPoolConfig().getAutoincrement()
dirtyEvents, has := validMap["d"]
if has {
for _, row := range dirtyEvents.([]interface{}) {
row.(map[interface{}]interface{})["Event"].(map[interface{}]interface{})["I"] = id
id += db.GetPoolConfig().getAutoincrement()
}
}
} else {
ids[i] = 0
}
} else {
ids[i] = 0
}
}
logEvents, has := validMap["l"]
Expand Down

0 comments on commit 7f5c382

Please sign in to comment.