本文整理汇总了Golang中pixelrelay/db.Dbh.AlbumDelete方法的典型用法代码示例。如果您正苦于以下问题:Golang Dbh.AlbumDelete方法的具体用法?Golang Dbh.AlbumDelete怎么用?Golang Dbh.AlbumDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pixelrelay/db.Dbh
的用法示例。
在下文中一共展示了Dbh.AlbumDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AlbumDelete
func AlbumDelete(args martini.Params, req *http.Request, r render.Render, su models.User, dbh *db.Dbh, p *models.Page) {
// Default status
var result string = "Not Deleted"
var status string = "Permission Denied"
var code int = 401
name := args["name"]
album := dbh.GetAlbumByName(name)
if album.User == su.Id {
status = "Success"
result = "Deleted"
dAlbum := dbh.AlbumDelete(album)
log.Printf("%+v", dAlbum)
}
if album.Id == 0 {
status = "Album not found"
code = 404
}
p.Data = models.AlbumResult{Name: name, Result: result, Status: status}
log.Println("Album Delete: User: ", su.Id, " Album: ", name, " Result: ", result, " Status: ", status)
encoder.Render("json", code, "", p, r)
}