Your Question

在多goroutines环境下单表查询,运行几个小时后,修改某个数据,查询能返回正确的值,继续再运行几个小时,再次查询,返回的数据跟表中数据不一致(中间没有再修改数据)

In the multi goroutines environment, after a single table query is run for several hours, modify a certain data, and the query can return the correct value. Continue to run for a few hours, and then query again. The returned data is inconsistent with the data in the table (there is no further modified data in the middle)

The document you expected this should be explained

Expected answer

在多goroutines环境下查询,数据返回与表中数据一致

In the multi goroutines environment, the data returned is consistent with the data in the table

Comment From: li-jin-gou

提供一个可复现的 demo 在 https://github.com/go-gorm/playground 上吧

Comment From: limawanyan

请问这个问题解决了吗?我碰到了类似的问题,单独开启了一个goroutines执行任务,在任务中会有查询数据库的操作,程序运行一段时间后出现查询不到新插入数据库记录的情况,重启项目就正常了。