forked from ebhomengo/niki
31 lines
857 B
Go
31 lines
857 B
Go
package mysqlkindboxreq
|
|
|
|
import (
|
|
"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
|
|
var countAccept sql.NullInt64
|
|
var desc sql.NullString
|
|
err := scanner.Scan(&kindBoxReq.ID, &kindBoxReq.BenefactorID, &kindBoxType, &kindBoxReq.DeliverAddressID, &kindBoxReq.CountRequested, &countAccept,
|
|
&desc,
|
|
&kindBoxReq.DeliverReferDate, &kindBoxStatus)
|
|
|
|
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)
|
|
|
|
return kindBoxReq, err
|
|
}
|