title: Can't sort in GORM
body: <p>I have a <code>News</code> structure, I want to display them in <code>descending date order</code>. But he displays them to me by id in the usual way</p>
  <p>Struct:</p>
  <pre><code>type News struct {
      Id        int       `json:&quot;id&quot; gorm:&quot;primary_key, AUTO_INCREMENT&quot;`
      ...
      CreatedAt time.Time `json:&quot;created_at&quot;`
  }
  </code></pre>
  <p>Funcs:</p>
  <pre><code>func GetAllNews(q *models.News, pagination *models.Pagination) (*[]models.News, error) {
      var news []models.News
      offset := (pagination.Page - 1) * pagination.Limit
      queryBuider := config.DB.Limit(pagination.Limit).Offset(offset).Order(pagination.Sort)
      result := queryBuider.Model(&amp;models.News{}).Where(q).Order(&quot;Id DESC&quot;).Find(&amp;news)
      if result.Error != nil {
          msg := result.Error
          return nil, msg
      }
      return &amp;news, nil
  }
  
  func GetAllNews_by_page(c *gin.Context) {
      pagination := GeneratePaginationFromRequest(c)
      var news models.News
      prodLists, err := GetAllNews(&amp;news, &amp;pagination)
  
      if err != nil {
          c.JSON(http.StatusBadRequest, err.Error())
          return
  
      }
      c.JSON(http.StatusOK, gin.H{
          &quot;data&quot;: prodLists,
      })
  
  }
  </code></pre>