GORM Playground Link

https://github.com/go-gorm/playground/pull/401

Description

  • This causes the query to become incorrect
  • For both queries two rows are expected, but for the second one 0 rows are returned

When issuing 2 consecutive queries with predefined *gorm.DB where condition, the second condition is appended to the first. Therefore, the resulting query is incorrect.

Comment From: jinzhu

https://gorm.io/docs/method_chaining.html

Comment From: HimangshuKakati

@jinzhu what to do for older versions of gorm where there is no New Session Method