forked from ebhomengo/niki
1
0
Fork 0
niki/repository/mysql/refer_time/scan.go

34 lines
599 B
Go
Raw Normal View History

package mysqlrefertime
import (
"database/sql"
"time"
"git.gocasts.ir/ebhomengo/niki/entity"
"git.gocasts.ir/ebhomengo/niki/repository/mysql"
)
func scanReferTime(scanner mysql.Scanner) (entity.ReferTime, error) {
var referTime entity.ReferTime
var (
status string
createdAt time.Time
updatedAt time.Time
deletedAt sql.NullTime
)
err := scanner.Scan(
&referTime.ID,
&referTime.Duration,
&status,
&createdAt,
&updatedAt,
&deletedAt,
)
if err != nil {
return entity.ReferTime{}, err
}
referTime.Status = entity.ReferTimeStatus(status)
return referTime, nil
}