本文整理汇总了Golang中github.com/stretchrcom/goweb/goweb.Context.RespondWithNotFound方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.RespondWithNotFound方法的具体用法?Golang Context.RespondWithNotFound怎么用?Golang Context.RespondWithNotFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/stretchrcom/goweb/goweb.Context
的用法示例。
在下文中一共展示了Context.RespondWithNotFound方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Read
// Handle GET requests
func (cr *OtterAPIController) Read(id string, cx *goweb.Context) {
var otter Otter
// TODO rewrite using a tohva stored in the session
var err error = nil
//_, err := cr.Db.Retrieve(id, &otter)
if err != nil {
cx.RespondWithData(otter)
} else {
cx.RespondWithNotFound()
}
}
示例2: Read
func (cr *TeamAPIController) Read(id string, cx *goweb.Context) {
if id == "1" {
cx.RespondWithData(TestEntity{id, "Mat", 28})
} else if id == "2" {
cx.RespondWithData(TestEntity{id, "Laurie", 27})
} else {
cx.RespondWithNotFound()
}
}
示例3: Delete
// Handle DELETE requests
func (cr *OtterAPIController) Delete(id string, cx *goweb.Context) {
//var otter Otter
// TODO rewrite using a tohva stored in the session
// currentRev, err := cr.Db.Retrieve(id, &otter)
var err error = nil
if err != nil {
// cr.Db.Delete(id, currentRev)
cx.RespondWithOK()
} else {
cx.RespondWithNotFound()
}
}