Gorm and or hybrid query

problem description

just used gorm for query but encountered some problems. I want to do some mixed query of and and or, but db.Where in gorm is an and query, but if you add .Or () to query, all the conditions will become or. Ask for help from the bosses, if and and mixed query how to achieve it.

related codes

SELECT * FROM users WHERE (mobile = "1880000000000" or email =" test@test.com") and status=1 ORDER BY users . id ASC LIMIT 1

Apr.02,2021

Where ("(mobile =? or email =?) and status < =?", "18800000000", "test@test.com", 1)

Menu