devicemngmt_old/find_by_device_id.go

22 lines
489 B
Go
Raw Normal View History

2021-08-17 04:03:50 +00:00
package devicemngt
import (
"context"
"github.com/Selly-Modules/logger"
)
// findByDeviceID ...
func (s Service) findByDeviceID(ctx context.Context, id string) (result Device) {
2021-08-17 04:38:27 +00:00
stm, args, _ := s.Builder.Select("*").From(TableDeviceMngt).Where("device_id = ?", id).ToSql()
2021-08-17 04:03:50 +00:00
2021-08-19 08:37:47 +00:00
if err := s.DB.QueryRowContext(ctx, stm, args...).Scan(&result); err != nil {
2021-08-17 04:03:50 +00:00
logger.Error("devicemngt - findByDeviceID", logger.LogData{
"device_id": id,
"error": err.Error(),
})
}
return
}