pop EagerPreload or Eager support filter like where ?
like this
func (v TreesResource) Show(c buffalo.Context) error {
// Get the DB connection from the context
tx, ok := c.Value("tx").(*pop.Connection)
if !ok {
return fmt.Errorf("no transaction found")
}
// Allocate an empty Tree
tree := &models.Tree{}
// To find the Tree the parameter tree_id is used.
if err := tx.EagerPreload("id in (?)", "1","2").Find(tree, c.Param("tree_id")); err != nil {
return c.Error(http.StatusNotFound, err)
}
return responder.Wants("html", func(c buffalo.Context) error {
c.Set("tree", tree)
return c.Render(http.StatusOK, r.HTML("trees/show.plush.html"))
}).Wants("json", func(c buffalo.Context) error {
return c.Render(200, r.JSON(tree))
}).Wants("xml", func(c buffalo.Context) error {
return c.Render(200, r.XML(tree))
}).Respond(c)
}
pop EagerPreload or Eager support filter like where ?
like this