You should be able to use a date directly in your SQL query. That looks like postgres. Have you tried something like this?
In your case it would look more like:
date := time.Now().Add(-24 * time.Hour)
rows, err := db.Query (`SELECT * FROM users
WHERE date_trunc('day', $1) = date_trunc('day', usr_edit)`, date)
Or something along those lines. Though since this has to do table scan it’s not super efficient. I generally prefer to do BETWEEN approach. But this should get you started. Also do you even need to pass in a time.Time? You could do this with just sql:
rows, err := db.Query (`SELECT * FROM users
WHERE date_trunc('day', now() - interval '1 day') = date_trunc('day', usr_edit)`)
… and if you want to go with BETWEEN approach to avoid table scan:
rows, err := db.Query (`
SELECT * FROM users
WHERE usr_edit
BETWEEN date_trunc('day', now() - interval '1 day')
AND date_trunc('day', now())`)