2024-01-22 08:14:57 +00:00
|
|
|
package mysqlkindboxreq
|
|
|
|
|
|
|
|
import (
|
2024-02-12 07:56:28 +00:00
|
|
|
"database/sql"
|
|
|
|
|
2024-01-22 08:14:57 +00:00
|
|
|
"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.AddressID, &kindBoxReq.CountRequested, &countAccept,
|
|
|
|
&desc,
|
2024-01-22 08:14:57 +00:00
|
|
|
&kindBoxReq.ReferDate, &kindBoxStatus, &kindBoxReq.CreatedAt)
|
|
|
|
|
2024-02-12 07:56:28 +00:00
|
|
|
if countAccept.Valid {
|
|
|
|
kindBoxReq.CountAccepted = uint(countAccept.Int64)
|
|
|
|
}
|
|
|
|
if desc.Valid {
|
|
|
|
kindBoxReq.Description = desc.String
|
|
|
|
}
|
2024-01-22 08:14:57 +00:00
|
|
|
kindBoxReq.Status = entity.MapToKindBoxReqStatus(kindBoxStatus)
|
|
|
|
kindBoxReq.KindBoxType = entity.MapToKindBoxType(kindBoxType)
|
2024-01-22 15:21:13 +00:00
|
|
|
|
2024-01-22 08:14:57 +00:00
|
|
|
return kindBoxReq, err
|
|
|
|
}
|