package mysqlkindboxreq import ( "database/sql" "time" "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 ( kindBoxType string countAccepted sql.NullInt64 description sql.NullString status string senderAgentID sql.NullInt64 deliveredAt sql.NullTime createdAt time.Time updatedAt time.Time deletedAt sql.NullTime ) err := scanner.Scan( &kindBoxReq.ID, &kindBoxReq.BenefactorID, &kindBoxType, &kindBoxReq.CountRequested, &countAccepted, &description, &status, &kindBoxReq.DeliverReferDate, &kindBoxReq.DeliverAddressID, &senderAgentID, &deliveredAt, &createdAt, &updatedAt, &deletedAt, ) if err != nil { return entity.KindBoxReq{}, err } kindBoxReq.KindBoxType = entity.MapToKindBoxType(kindBoxType) if countAccepted.Valid { kindBoxReq.CountAccepted = uint(countAccepted.Int64) } if description.Valid { kindBoxReq.Description = description.String } kindBoxReq.Status = entity.MapToKindBoxReqStatus(status) if senderAgentID.Valid { kindBoxReq.SenderAgentID = uint(senderAgentID.Int64) } if deliveredAt.Valid { kindBoxReq.DeliveredAt = deliveredAt.Time } return kindBoxReq, nil }