title: how to get values basis on keys from a Struct Elixir
body: <p>I have this value as </p>
  
  <pre><code>%{is_public: true, discoverable: true}
  </code></pre>
  
  <p>This could be anything not specifically <code>is_public</code> and <code>discoverable</code>, but all the <code>keys</code> which will come in above <code>Map</code> will be available in a <code>struct</code> of a camera.</p>
  
  <pre><code>%Camera{
    __meta__: #Ecto.Schema.Metadata&lt;:loaded, "cameras"&gt;,
    created_at: #DateTime&lt;2017-08-25 14:13:55.524563Z&gt;,
    discoverable: true,
    exid: "everc-fhlcr",
    id: 12769,
    is_online: true,
    is_online_email_owner_notification: false,
    is_public: true,
    last_online_at: #DateTime&lt;2019-05-14 11:10:45.000000Z&gt;,
    last_polled_at: #DateTime&lt;2019-05-14 11:10:47.000000Z&gt;,
  }
  </code></pre>
  
  <p>I want to get the values from the <code>Camera</code> struct on the basis of <code>Map</code> i.e</p>
  
  <pre><code>iex(4)&gt; changes = %{is_public: true, discoverable: true} |&gt; Map.keys
  [:discoverable, :is_public]
  </code></pre>
  
  <p>I can get the keys from changes map with <code>Map.keys</code></p>
  
  <p>But I am not sure about how to map values from Camera struct.</p>
  
  <p>from above Camera Struct and changes map, I want to get this type of Map.</p>
  
  <pre><code>%{
   is_public: true,
   discoverable: true
  }
  </code></pre>
  
  <p>it seems like the same above map but it depends on Camera Struct values, they both can be false or true , same as id, exid, is_online.</p>
  
  <p>If I do this </p>
  
  <pre><code>Enum.map(changed_keys, fn(key) -&gt;
    key: Map.get(camera, key)
  end)
  </code></pre>
  
  <p>This still doesn't work, any help would be appreciable. thanks </p>
  
  <p>I just want to make a map with anonymous keys in <code>changes</code> Map, and then get their values from <code>Camera</code> Struct and create a new map with those values and anonymouse keys.</p>