niki/repository/mysql/kind_box_req/scan.go

31 lines
857 B
Go
Raw Normal View History

package mysqlkindboxreq
import (
2024-02-12 07:56:28 +00:00
"database/sql"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/repository/mysql"
)
func scanKindBoxReq(scanner mysql.Scanner) (entity.KindBoxReq, error) {
var kindBoxReq entity.KindBoxReq
var kindBoxStatus string
var kindBoxType string
2024-02-12 07:56:28 +00:00
var countAccept sql.NullInt64
var desc sql.NullString
err := scanner.Scan(&kindBoxReq.ID, &kindBoxReq.BenefactorID, &kindBoxType, &kindBoxReq.DeliverAddressID, &kindBoxReq.CountRequested, &countAccept,
2024-02-12 07:56:28 +00:00
&desc,
&kindBoxReq.DeliverReferDate, &kindBoxStatus)
2024-02-12 07:56:28 +00:00
if countAccept.Valid {
kindBoxReq.CountAccepted = uint(countAccept.Int64)
}
if desc.Valid {
kindBoxReq.Description = desc.String
}
kindBoxReq.Status = entity.MapToKindBoxReqStatus(kindBoxStatus)
kindBoxReq.KindBoxType = entity.MapToKindBoxType(kindBoxType)
2024-01-22 15:21:13 +00:00
return kindBoxReq, err
}