22 lines
483 B
Go
22 lines
483 B
Go
|
package devicemngt
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/Selly-Modules/logger"
|
||
|
)
|
||
|
|
||
|
// findByDeviceID ...
|
||
|
func (s Service) findByDeviceID(ctx context.Context, id string) (result Device) {
|
||
|
stm, args, _ := s.Builder.Select("*").From(DeviceMngtTableName).Where("device_id = ?", id).ToSql()
|
||
|
|
||
|
if err := s.DB.GetContext(ctx, &result, stm, args...); err != nil {
|
||
|
logger.Error("devicemngt - findByDeviceID", logger.LogData{
|
||
|
"device_id": id,
|
||
|
"error": err.Error(),
|
||
|
})
|
||
|
}
|
||
|
|
||
|
return
|
||
|
}
|