Can I pass in a map in gorm to support range query for numeric or time-based values? Like, if I have a column named mileage, make WHERE mileage BETWEEN 100 AND 200 into a map and let gorm do db.Where(map).Find(&cars)
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨
Comment From: li-jin-gou
refer to https://gorm.cn/docs/query.html#String-Conditions
// BETWEEN
db.Where("created_at BETWEEN ? AND ?", lastWeek, today).Find(&users)
// SELECT * FROM users WHERE created_at BETWEEN '2000-01-01 00:00:00' AND '2000-01-08 00:00:00';
and not support use map condition to generate BETWEEN ** AND **