Add VERSION query param support to REST GET route

This commit is contained in:
Tobie Morgan Hitchcock 2017-11-16 20:43:26 +00:00
parent 0675bdb000
commit 28c10c9747

View file

@ -195,12 +195,13 @@ func routes(s *fibre.Fibre) {
s.Get("/key/:class", func(c *fibre.Context) error { s.Get("/key/:class", func(c *fibre.Context) error {
txt := "SELECT * FROM $class LIMIT $limit START $start" txt := "SELECT * FROM $class LIMIT $limit START $start VERSION $versn"
res, err := db.Execute(c, txt, map[string]interface{}{ res, err := db.Execute(c, txt, map[string]interface{}{
"class": sql.NewTable(c.Param("class")), "class": sql.NewTable(c.Param("class")),
"limit": limit(c, 100), "limit": limit(c, 100),
"start": start(c, 0), "start": start(c, 0),
"versn": versn(c, time.Now()),
}) })
return show.Output(c, c.Param("class"), show.Many, show.Select, res, err) return show.Output(c, c.Param("class"), show.Many, show.Select, res, err)