本文整理汇总了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)
}