本文整理匯總了Golang中github.com/labstack/echo.Context.RemoveId方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.RemoveId方法的具體用法?Golang Context.RemoveId怎麽用?Golang Context.RemoveId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/labstack/echo.Context
的用法示例。
在下文中一共展示了Context.RemoveId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CloseSession
// CloseSession takes a digits auth and converts it into internal auth
func CloseSession(c *echo.Context) (int, interface{}) {
hauth, ok := c.Get("habloAuth").(*models.HabloAuth)
if !ok {
return msg.Forbidden("must include an authorization")
}
log.Printf("Awaiting for [HabloAuth = %s] deletion", hauth.ID.Hex())
err := mangos.Execute(collection, func(c *mgo.Collection) error {
return c.RemoveId(hauth.ID)
})
if err != nil {
log.Printf("Cannot remove [HabloAuth = %s]: %s", hauth.ID.Hex(), err)
return msg.InternalError(err)
}
log.Printf("Removed [HabloAuth = %s]", hauth.ID.Hex())
return msg.Ok("see you")
}
示例2: Delete
// Delete removes the indicated object from database.
// ID must be the same as session.
func Delete(c *echo.Context) (int, interface{}) {
var err error
reqid, _ := strconv.ParseInt(c.Param("id"), 10, 64)
attid, _ := c.Get("digitsID").(int64)
if reqid == attid {
// Execute delete
log.Printf("Awaiting for [Profile = %d] delete", reqid)
err = mangos.Execute(collection, func(c *mgo.Collection) error {
return c.RemoveId(reqid)
})
if err != nil {
log.Printf("Cannot delete [Profile = %d]: %s", reqid, err)
return msg.InternalError(err)
}
log.Printf("Deleted [Profile = %d]", reqid)
return msg.Ok("deleted")
}
return msg.Forbidden("the id does not belongs to user")
}