Open charbelcs123 opened 1 month ago
Hi, this is an interesting issue. Yes, scany is thread-safe, as long as your underlying driver library instance, d.rDb
, is thread-safe. To debug this, I would recommend printing SelectSubscriptionOverviewSql
and executing it on the database directly (without scany) to see what columns it returns right before where you get the error.
Ok, Thank you for clearing that out, Usually the query works, and then the process starts crashing after a while with random errors for different queries Maybe i am missing something, I am not sure.
type ServiceOverview struct { ServiceId uint64
db:"ID"
SubscriptionId uint64db:"SUB_ID"
StatusId int32db:"STATUS_ID"
}const SelectSubscriptionOverviewSql string =
SELECT TO_CHAR(s.id) as ID, TO_CHAR(s.SUBSCRIPTION_ID) as SUB_ID, s.STATUS_ID FROM Service
func (d *Dao) GetServiceOverviews(ctx context.Context, accountId uint64, bgId uint64) ([]ServiceOverview, error) {
}
I am getting the following error: scanning one: scanning: doing scan: scanFn: scany: column: 'A_NUMBER': no corresponding field found, or it's unexported in models.ServiceOverview
Please note that A_NUMBER is not present in SelectSubscriptionOverviewSql