ITADN

[BUG] Scan SQL Value Error

#391Closedshuqingzai 创建于 2024-12-27
S
shuqingzaicommented
When the query result is null, Scan does not handle the case where value is nil See: 1. https://github.com/shopspring/decimal/blob/a1bdfc355e9c71119322b748c95f7d6b82566e30/decimal.go#L1831 2. https://github.com/shopspring/decimal/blob/a1bdfc355e9c71119322b748c95f7d6b82566e30/decimal.go#L2032 ```text sql: Scan error on column index 0, name "total_price": could not convert value '<nil>' to byte array of type '<nil>' [rows:1] SELECT SUM(`order_item`.`totalPrice`) AS `total_price` FROM `order_item` WHERE `order_item`.`orderId` = 192668317566144512 AND `order_item`.`status` = 2 AND `order_item`.`settlementStatus` = 3 AND `order_item`.`deletedAt` IS NULL ```
关闭于 2024-12-27 0 条评论