本文整理匯總了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)
}