go build error“ NEXT undefined

我想在go中的行中使用NEXT,但我的vw在行中收到了警告。NEXT 它说 NEXT undefined (type *“database/sql”)。行没有字段或方法 NEXT)


     func FetchViewDO() (shipment_admin.ShipmentViewDetailDOGroup, error) {

            var obj ShipmentDOBaseModel

            var objg ShipmentDOGroup

            var arrobj []ShipmentDOBaseModel

            var res shipment_admin.ShipmentViewDetailDOGroup

        

            var db *sql.DB

        

            con := db

            sqlStatement := `SELECT s.status_id,sdog.*,sdo.shipment_id,sdo.external_id,sdo.client_code

        FROM shipment_delivery_order sdo

        LEFT JOIN shipment_delivery_order_group sdog ON sdog.shipment_child_id = sdo.shipment_id

        LEFT JOIN shipment s ON s.shipment_id = sdo.shipment_id`

        

            rows, err := con.Query(sqlStatement)

            defer rows.Close()

        

            if err != nil {

                return res, err

            }

        

            for rows.NEXT() {

                err = rows.Scan(&objg.ShipmentParentID, &objg.CreatedAt, &objg.ShipmentChildID)

                if err != nil {

                    return res, err

                }

            }

            res.Status = http.StatusOK

            res.Message = "Success"

            res.Data = arrobj

        

            return res, nil

        

        }


墨色风雨
浏览 99回答 1
1回答

HUX布斯

没有称为NEXT的方法,但有一个名为Next的方法,我认为这是您问题的答案,请记住Go是区分大小写的
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go