本文整理匯總了Golang中github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/gin-gonic/gin.Context.Get方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.Get方法的具體用法?Golang Context.Get怎麽用?Golang Context.Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/gin-gonic/gin.Context
的用法示例。
在下文中一共展示了Context.Get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handleTransact
func (this *RestServer) handleTransact(c *gin.Context) {
_, hold := c.Get("hold")
param := &TransactParam{}
errD := this.codec.Decode(param, c.Request.Body)
if errD != nil {
c.AbortWithError(500, errD)
}
if hold {
res, err := this.pipe.Transactor().TransactAndHold(param.PrivKey, param.Address, param.Data, param.GasLimit, param.Fee)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(res, c.Writer)
} else {
receipt, err := this.pipe.Transactor().Transact(param.PrivKey, param.Address, param.Data, param.GasLimit, param.Fee)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(receipt, c.Writer)
}
}
示例2: handleNameRegEntries
func (this *RestServer) handleNameRegEntries(c *gin.Context) {
var filters []*ep.FilterData
fs, exists := c.Get("filters")
if exists {
filters = fs.([]*ep.FilterData)
}
entries, err := this.pipe.NameReg().Entries(filters)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(entries, c.Writer)
}
示例3: handleBlocks
func (this *RestServer) handleBlocks(c *gin.Context) {
var filters []*ep.FilterData
fs, exists := c.Get("filters")
if exists {
filters = fs.([]*ep.FilterData)
}
blocks, err := this.pipe.Blockchain().Blocks(filters)
if err != nil {
c.AbortWithError(500, err)
}
c.Writer.WriteHeader(200)
this.codec.Encode(blocks, c.Writer)
}