示例#1
0
// 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
0
文件: team.go 项目: robxu9/reservoir
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
0
// 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()
	}
}