code: func GetPendingDeviceQueueItemForDevEUI(db sqlx.Queryer, devEUI lorawan.EUI64) (DeviceQueueItem, error) {
  	var qi DeviceQueueItem
  	err := sqlx.Get(db, &qi, `
          select
              *
          from
              device_queue
          where
              dev_eui = $1
          order by
              f_cnt
          limit 1`,
  		devEUI[:],
  	)
  	if err != nil {
  		return qi, handlePSQLError(err, "select error")
  	}
  
  	if !qi.IsPending {
  		return qi, ErrDoesNotExist
  	}
  
  	return qi, nil
  }
docs: // GetPendingDeviceQueueItemForDevEUI returns the pending device-queue item for the
  // given DevEUI.