code: func ValidateDevNonce(db sqlx.Queryer, joinEUI, devEUI lorawan.EUI64, nonce lorawan.DevNonce, joinType lorawan.JoinType) error {
  	var count int
  	err := sqlx.Get(db, &count, `
  		select
  			count(*)
  		from
  			device_activation
  		where
  			dev_eui = $1
  			and join_eui = $2
  			and dev_nonce = $3
  			and join_req_type = $4`,
  		devEUI,
  		joinEUI,
  		nonce,
  		joinType,
  	)
  	if err != nil {
  		return handlePSQLError(err, "select error")
  	}
  
  	if count != 0 {
  		return ErrAlreadyExists
  	}
  
  	return nil
  }
docs: // ValidateDevNonce validates the given dev-nonce for the given
  // DevEUI / JoinEUI combination.