本文整理匯總了Golang中github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/gin-gonic/gin.Context.MustGet方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.MustGet方法的具體用法?Golang Context.MustGet怎麽用?Golang Context.MustGet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/gin-gonic/gin.Context
的用法示例。
在下文中一共展示了Context.MustGet方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handlePeer
func (this *RestServer) handlePeer(c *gin.Context) {
address := c.MustGet("address").(string)
peer, err := this.pipe.Net().Peer(address)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(peer, c.Writer)
}
示例2: handleNameRegEntry
func (this *RestServer) handleNameRegEntry(c *gin.Context) {
name := c.MustGet("name").(string)
entry, err := this.pipe.NameReg().Entry(name)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(entry, c.Writer)
}
示例3: handleEventUnsubscribe
func (this *RestServer) handleEventUnsubscribe(c *gin.Context) {
subId := c.MustGet("id").(string)
err := this.eventSubs.remove(subId)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(&ep.EventUnsub{true}, c.Writer)
}
示例4: handleEventPoll
func (this *RestServer) handleEventPoll(c *gin.Context) {
subId := c.MustGet("id").(string)
data, err := this.eventSubs.poll(subId)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(&ep.PollResponse{data}, c.Writer)
}
示例5: handleBlock
func (this *RestServer) handleBlock(c *gin.Context) {
height := c.MustGet("height").(int)
block, err := this.pipe.Blockchain().Block(height)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(block, c.Writer)
}
示例6: handleStorage
func (this *RestServer) handleStorage(c *gin.Context) {
addr := c.MustGet("addrBts").([]byte)
s, err := this.pipe.Accounts().Storage(addr)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(s, c.Writer)
}