本文整理汇总了Golang中github.com/Castcloud/castcloud-go-server/Godeps/_workspace/src/github.com/labstack/echo.Context.Request方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Request方法的具体用法?Golang Context.Request怎么用?Golang Context.Request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Castcloud/castcloud-go-server/Godeps/_workspace/src/github.com/labstack/echo.Context
的用法示例。
在下文中一共展示了Context.Request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getNewEpisodes
//
// GET /library/newepisodes
//
func getNewEpisodes(c *echo.Context) error {
now := time.Now().Unix()
user := c.Get("user").(*User)
since := c.Request().URL.Query().Get("since")
if since == "" {
return c.JSON(200, newEpisodes{
Timestamp: now,
Episodes: store.GetEpisodesSince(0, user.Subscriptions),
})
}
ts, err := strconv.ParseInt(since, 10, 64)
if err != nil {
return c.NoContent(400)
}
return c.JSON(200, newEpisodes{
Timestamp: now,
Episodes: store.GetEpisodesSince(ts, user.Subscriptions),
})
}
示例2: getEvents
//
// GET /library/events
//
func getEvents(c *echo.Context) error {
now := time.Now().Unix()
var err error
var ts uint64
since := c.Request().URL.Query().Get("since")
if since != "" {
ts, err = strconv.ParseUint(since, 10, 64)
if err != nil {
return c.NoContent(400)
}
}
user := c.Get("user").(*User)
uuid := ""
excludeSelf := c.Request().URL.Query().Get("exclude_self")
if excludeSelf == "true" {
uuid = c.Get("uuid").(string)
}
return c.JSON(200, events{
Timestamp: now,
Events: store.GetEvents(user.ID, ts, uuid),
})
}
示例3: form
func form(c *echo.Context, key string) string {
return c.Request().FormValue(key)
}