title: Elixir Map - Group by and order fields
body: <p>In Elixir i have this map</p>
  
  <pre><code>   my_map =  [%{ user_id: 1, user_name: "David", gamer_id: 100, gamer_name: "John"  },
      %{ user_id: 1, user_name: "David", gamer_id: 101, gamer_name: "Bil"  },
      %{ user_id: 1, user_name: "David", gamer_id: 103, gamer_name: "Ruk"  },
      %{ user_id: 2, user_name: "Ron", gamer_id: 104, gamer_name: "Sam"  },
      %{ user_id: 2, user_name: "Ron", gamer_id: 105, gamer_name: "Sean"  }]
  </code></pre>
  
  <p>I want to transform that to below output</p>
  
  <p>Output :</p>
  
  <pre><code>[%{ user_id: 1, username: "David", 
      games: [
          %{
              gamer_id: 100,
              gamer_name: "John"
          },
          %{
              gamer_id: 101,
              gamer_name: "Bil"
          },
          %{
              gamer_id: 103,
              gamer_name: "Ruk"
          }
      ]
  },
  %{ user_id: 2, username: "Ron", 
      games: [
          %{
              gamer_id: 104,
              gamer_name: "Sam"
          },
          %{
              gamer_id: 105,
              gamer_name: "Sean"
          }
      ]
  }]
  </code></pre>
  
  <p>I tried Enum.group_by and all but could not achieve it</p>
  
  <p>my_map |> Enum.group_by(fn(x) -> x.user_id end)</p>
  
  <p>Any insight on how to achieve this will be greatly appreciated.</p>