title: How can I insert a golang map into PostgreSQL
body: <p>I have a json object sent from a mobile application, looks like this:</p>
  
  <pre><code>{
      "product_id": "0123456789",
      "name": "PRODUCT_NAME",
      "manufacturer": "PRODUCT_MANUFACTURER",
      "image_url": "IMAGE_URL",
      "additional_info": "",
      "store_id": "STORE_ID",
      "store_name": "STORE_NAME",
      "owner_id": "OWNER_ID",
      "quantities": {
          "1000": 10.0,
          "1500": 12.0,
      }
  }
  </code></pre>
  
  <p>The key value in <code>quantities</code> is a for example, can be grams, and the value is a representes a price.
  So for example, 1000 grams of rice will cost 10$, and 1500 grams of rice will cost 12.0$ (as a sale or something)</p>
  
  <p>I have a Model Object in my <code>Go</code> code, that has the <code>quantities</code> filed as <code>map[int]float32</code>
  I'm trying to find a way to insert this map into a <code>PostgreSQL</code> database I have, but can't figure out how.</p>
  
  <p>This is my <code>Go</code> Model:</p>
  
  <pre><code>type Product struct {
      ID             string          
      UUID           string          
      Name           string         
      Manufacturer   string         
      ImageURL       string         
      AdditionalInfo string          
      StoreID        string         
      StoreName      string          
      OwnerID        string          
      Quantities     map[int]float32
  }
  </code></pre>
  
  <p>I read about <code>JSONB</code> but won't it return a <code>json</code> when I retrieve the data? I need it to return a <code>map[int]float32</code> and not <code>json</code>.</p>