title: Select exists with GORM
body: <p>I want to check if a row exists in a database table or not. I first used this approach:</p>
  <pre><code>type MyStruct struct {
      ID    uint32
      Key   string
      Value string
  }
  
  var result MyStruct
  
  err := db.
      Where(&quot;id = ? AND `key` = ? AND `value` = 0&quot;, myID, myKey).
      First(&amp;result).
      Error
  
  if err != nil {
      if err == gorm.ErrRecordNotFound {
          logrus.Error(&quot;ErrRecordNotFound&quot;)
      }
      logrus.Errorf(&quot;Other DB error: %s&quot;, err.Error())
  }
  </code></pre>
  <p>But I want to achieve this by writing a raw SQL. I tried following:</p>
  <pre><code>var result bool
  
  db.Raw(&quot;SELECT EXISTS(SELECT 1 FROM my_table WHERE id = ? AND `key` = ? AND `value` = ?)&quot;,
      myID, myKey, &quot;0&quot;).Scan(&amp;result)
  </code></pre>
  <p>But I get this error:</p>
  <pre><code>unsupported destination, should be slice or struct.
  </code></pre>
  <p>I also tried to use method <code>Exec</code> and got the same error.</p>
  <p>Note that the variable <code>db</code> is a <code>*gorm.DB</code> instance.</p>