本文整理匯總了Golang中github.com/Unknwon/orbiter/modules/context.Context.ParamsInt64方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.ParamsInt64方法的具體用法?Golang Context.ParamsInt64怎麽用?Golang Context.ParamsInt64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Unknwon/orbiter/modules/context.Context
的用法示例。
在下文中一共展示了Context.ParamsInt64方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ViewWebhook
func ViewWebhook(ctx *context.Context) {
ctx.Data["Title"] = "View Webhook"
ctx.Data["PageIsWebhook"] = true
ctx.Data["RequireHighlightJS"] = true
webhook, err := models.GetWebhookByID(ctx.ParamsInt64(":id"))
if err != nil {
if errors.IsWebhookNotFound(err) {
ctx.Handle(404, "GetWebhookByID", nil)
} else {
ctx.Handle(500, "GetWebhookByID", err)
}
return
}
ctx.Data["Webhook"] = webhook
// Prettify JSON in case it is not.
buf := new(bytes.Buffer)
if err = json.Indent(buf, []byte(webhook.Payload), "", " "); err != nil {
ctx.Handle(500, "json.Indent", err)
return
}
webhook.Payload = buf.String()
ctx.HTML(200, "webhook/view")
}
示例2: DeleteApplication
func DeleteApplication(ctx *context.Context) {
if err := models.DeleteApplicationByID(ctx.ParamsInt64(":id")); err != nil {
ctx.Error(500, err.Error())
return
}
ctx.Redirect("/applications")
}
示例3: RegenerateApplicationSecret
func RegenerateApplicationSecret(ctx *context.Context) {
if err := models.RegenerateApplicationToken(ctx.ParamsInt64(":id")); err != nil {
ctx.Error(500, err.Error())
return
}
ctx.Redirect(fmt.Sprintf("/applications/%d", ctx.ParamsInt64(":id")))
}
示例4: DeleteCollector
func DeleteCollector(ctx *context.Context) {
if err := models.DeleteCollectorByID(ctx.ParamsInt64(":id")); err != nil {
ctx.Error(500, err.Error())
return
}
ctx.Redirect("/collectors")
}
示例5: RegenerateCollectorSecret
func RegenerateCollectorSecret(ctx *context.Context) {
if err := models.RegenerateCollectorSecret(ctx.ParamsInt64(":id")); err != nil {
ctx.Error(500, err.Error())
return
}
ctx.Redirect(fmt.Sprintf("/collectors/%d", ctx.ParamsInt64(":id")))
}
示例6: parseApplicationByID
func parseApplicationByID(ctx *context.Context) *models.Application {
app, err := models.GetApplicationByID(ctx.ParamsInt64(":id"))
if err != nil {
if errors.IsApplicationNotFound(err) {
ctx.Handle(404, "EditApplication", nil)
} else {
ctx.Handle(500, "GetApplicationByID", err)
}
return nil
}
ctx.Data["Application"] = app
return app
}
示例7: parseCollectorByID
func parseCollectorByID(ctx *context.Context) *models.Collector {
collector, err := models.GetCollectorByID(ctx.ParamsInt64(":id"))
if err != nil {
if errors.IsCollectorNotFound(err) {
ctx.Handle(404, "EditApplication", nil)
} else {
ctx.Handle(500, "GetCollectorByID", err)
}
return nil
}
ctx.Data["Collector"] = collector
return collector
}