Gorm: db.Scan method question

Created on 25 Sep 2020  ·  2Comments  ·  Source: go-gorm/gorm

Your Question

I found in this commit the implementation of db.Scan has changed, now(v1.20.1) it use row processor to execute instead of query processor which breaks previous behaviors of db.Scan method. I try to add a callback after row, it likes db.Callback().Row().After("gorm:row").Register("decrypt_data", decryptData) but since the dest is explicitly specified after call db.ScanRows method in db.Scan, how can I do some extra work after query(such as decrypt sensitive data)?

The document you expected this should be explained

Expected answer

question

All 2 comments

Hello,

Yes, the Scan methods should not call Hooks methods, so I made the change, it doesn't make sense to have another methods to works exactly like Find, any reason that don't use Find?

Hello,

Yes, the Scan methods should not call Hooks methods, so I made the change, it doesn't make sense to have another methods to works exactly like Find, any reason that don't use Find?

No, just want to get a confirmation. I will replace Scan method in my legacy code with Find method. Thank you for your prompt reply.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zeropool picture zeropool  ·  3Comments

littletwolee picture littletwolee  ·  3Comments

koalacxr picture koalacxr  ·  3Comments

corvinusy picture corvinusy  ·  3Comments

izouxv picture izouxv  ·  3Comments