func (r *GormWorkItemRepository) LoadFromDB(ctx context.Context, workitemID string) (*WorkItemStorage, error) {
	id, err := strconv.ParseUint(workitemID, 10, 64)
	if err != nil || id == 0 {
		// treating this as a not found error: the fact that we're using number internal is implementation detail
		return nil, errors.NewNotFoundError("work item", workitemID)
	}
	log.Info(nil, map[string]interface{}{
		"wi_id": workitemID,
	}, "Loading work item")

	res := WorkItemStorage{}
	tx := r.db.First(&res, id)
	if tx.RecordNotFound() {
		log.Error(nil, map[string]interface{}{
			"wi_id": workitemID,
		}, "work item not found")
		return nil, errors.NewNotFoundError("work item", workitemID)
	}
	if tx.Error != nil {
		return nil, errors.NewInternalError(tx.Error.Error())
	}
	return &res, nil
}
// LoadFromDB returns the work item with the given ID in model representation.
LoadFromDB returns the work item with the given ID in model representation.
// LoadFromDB returns the work item with the given ID in model representation .
func (r *GormWorkItemRepository) LoadFromDB(ctx context.Context, workitemID string) (*WorkItemStorage, error) {
	id, err := strconv.ParseUint(workitemID, 10, 64)
	if err != nil || id == 0 {
		return nil, errors.NewNotFoundError("work item", workitemID)
	}
	log.Info(nil, map[string]interface{}{
		"wi_id": workitemID,
	}, "Loading work item")
	res := WorkItemStorage{}
	tx := r.db.First(&res, id)
	if tx.RecordNotFound() {
		log.Error(nil, map[string]interface{}{
			"wi_id": workitemID,
		}, "work item not found")
		return nil, errors.NewNotFoundError("work item", workitemID)
	}
	if tx.Error != nil {
		return nil, errors.NewInternalError(tx.Error.Error())
	}
	return &res, nil
}
func ( r * GormWorkItemRepository ) LoadFromDB ( ctx context . Context , workitemID string ) ( * WorkItemStorage , error ) { id , err := strconv . ParseUint ( workitemID , 10 , 64 ) if err != nil || id == 0 { return nil , errors . NewNotFoundError ( " " , workitemID ) } log . Info ( nil , map [ string ] interface { } { " " : workitemID , } , " " ) res := WorkItemStorage { } tx := r . db . First ( & res , id ) if tx . RecordNotFound ( ) { log . Error ( nil , map [ string ] interface { } { " " : workitemID , } , " " ) return nil , errors . NewNotFoundError ( " " , workitemID ) } if tx . Error != nil { return nil , errors . NewInternalError ( tx . Error . Error ( ) ) } return & res , nil }
LoadFromDB returns the work item with the given ID in model representation.
LoadFromDB returns the work item with the given ID in model representation .
// treating this as a not found error: the fact that we're using number internal is implementation detail