本文整理匯總了Golang中github.com/coraldane/ops-meta/g.JsonResult類的典型用法代碼示例。如果您正苦於以下問題:Golang JsonResult類的具體用法?Golang JsonResult怎麽用?Golang JsonResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了JsonResult類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Delete
func (this *RelEndpointGroupController) Delete() {
jsonResult := g.JsonResult{}
id, _ := this.GetInt64("Id")
item := models.RelEndpointGroup{Id: id}
result, err := item.DeleteByPK()
if nil != err {
jsonResult.Message = err.Error()
} else if result > 0 {
jsonResult.Success = true
} else {
jsonResult.Message = "更新失敗,數據不存在"
}
this.Data["json"] = &jsonResult
this.ServeJSON()
}
示例2: Delete
func (this *AgentController) Delete() {
jsonResult := g.JsonResult{}
id, _ := this.GetInt64("Id")
item := models.Agent{Id: id, Name: this.GetString("name")}
result, err := item.DeleteByPK()
if nil != err {
jsonResult.Message = err.Error()
} else if result > 0 {
store.DesiredAgentsMap.Delete(item.Name)
jsonResult.Success = true
} else {
jsonResult.Message = "更新失敗,數據不存在"
}
this.Data["json"] = &jsonResult
this.ServeJSON()
}
示例3: Delete
func (this *EndpointController) Delete() {
jsonResult := g.JsonResult{}
id, _ := this.GetInt64("Id")
hostname := this.GetString("Hostname")
item := models.Endpoint{Id: id}
result, err := item.DeleteByPK()
if nil != err {
jsonResult.Message = err.Error()
} else if result > 0 {
store.HostAgents.Delete(hostname)
jsonResult.Success = true
} else {
jsonResult.Message = "更新失敗,數據不存在"
}
this.Data["json"] = &jsonResult
this.ServeJSON()
}
示例4: Save
func (this *AgentController) Save() {
jsonResult := g.JsonResult{}
item := models.Agent{}
if err := this.ParseForm(&item); nil != err {
logger.Errorln("parseForm error", err)
jsonResult.Message = err.Error()
} else {
if 0 >= item.Id {
item.GmtCreate = time.Now()
}
result, err := item.Insert()
if nil != err {
jsonResult.Message = err.Error()
} else if 0 < result {
jsonResult.Success = true
} else {
jsonResult.Message = "保存失敗,未知錯誤"
}
}
this.Data["json"] = &jsonResult
this.ServeJSON()
}