本文整理匯總了Golang中github.com/ChihChaoChang/worldping-api/pkg/middleware.Context.ParamsInt64方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.ParamsInt64方法的具體用法?Golang Context.ParamsInt64怎麽用?Golang Context.ParamsInt64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ChihChaoChang/worldping-api/pkg/middleware.Context
的用法示例。
在下文中一共展示了Context.ParamsInt64方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: V1DeleteMonitor
func V1DeleteMonitor(c *middleware.Context) {
id := c.ParamsInt64(":id")
check, err := sqlstore.GetCheckById(c.OrgId, id)
if err != nil {
handleError(c, err)
return
}
// get the endpoint that the check belongs too.
endpoint, err := sqlstore.GetEndpointById(c.OrgId, check.EndpointId)
if err != nil {
handleError(c, err)
return
}
// now update the endpoint and remove the check.
newChecks := make([]m.Check, 0)
for _, ch := range endpoint.Checks {
if ch.Id != id {
newChecks = append(newChecks, ch)
}
}
endpoint.Checks = newChecks
err = sqlstore.UpdateEndpoint(endpoint)
if err != nil {
handleError(c, err)
return
}
c.JSON(200, "monitor deleted")
}
示例2: GetOrgQuotas
func GetOrgQuotas(c *middleware.Context) *rbody.ApiResponse {
var quotas []m.OrgQuotaDTO
var err error
org := c.ParamsInt64("orgId")
if setting.Quota.Enabled {
quotas, err = sqlstore.GetOrgQuotas(org)
if err != nil {
return rbody.ErrResp(500, err)
}
} else {
quotas = []m.OrgQuotaDTO{
{
OrgId: org,
Target: "endpoint",
Limit: -1,
Used: -1,
},
{
OrgId: org,
Target: "probe",
Limit: -1,
Used: -1,
},
}
}
return rbody.OkResp("quotas", quotas)
}
示例3: V1DeleteCollector
func V1DeleteCollector(c *middleware.Context) {
id := c.ParamsInt64(":id")
err := sqlstore.DeleteProbe(id, c.OrgId)
if err != nil {
handleError(c, err)
return
}
c.JSON(200, "collector deleted")
return
}
示例4: V1GetCollectorById
func V1GetCollectorById(c *middleware.Context) {
id := c.ParamsInt64(":id")
probe, err := sqlstore.GetProbeById(id, c.OrgId)
if err != nil {
handleError(c, err)
return
}
c.JSON(200, probe)
return
}
示例5: UpdateOrgQuota
func UpdateOrgQuota(c *middleware.Context) *rbody.ApiResponse {
orgId := c.ParamsInt64(":orgId")
target := c.Params(":target")
limit := c.ParamsInt64(":limit")
if _, ok := setting.Quota.Org.ToMap()[target]; !ok {
return rbody.NotFound
}
quota := m.OrgQuotaDTO{
OrgId: orgId,
Target: target,
Limit: limit,
}
err := sqlstore.UpdateOrgQuota("a)
if err != nil {
return rbody.ErrResp(500, err)
}
return rbody.OkResp("quota", quota)
}