本文整理匯總了Golang中github.com/go-martini/martini.Context.Set方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.Set方法的具體用法?Golang Context.Set怎麽用?Golang Context.Set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/go-martini/martini.Context
的用法示例。
在下文中一共展示了Context.Set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: mapChannels
// Map the Receiver to a chan<- string for the next Handler(s)
// Map the Receiver to a <-chan string for the next Handler(s)
func (c *MessageConnection) mapChannels(context martini.Context) {
context.Set(reflect.ChanOf(reflect.SendDir, reflect.TypeOf(c.Sender).Elem()), reflect.ValueOf(c.Sender))
context.Set(reflect.ChanOf(reflect.RecvDir, reflect.TypeOf(c.Receiver).Elem()), reflect.ValueOf(c.Receiver))
}
示例2: mapDefaultChannels
// Helper method to map default channels in the context
// Map the Error Channel to a <-chan error for the next Handler(s)
// Map the Disconnect Channel to a chan<- bool for the next Handler(s)
// Map the Done Channel to a <-chan bool for the next Handler(s)
func (c *Connection) mapDefaultChannels(context martini.Context) {
context.Set(reflect.ChanOf(reflect.RecvDir, reflect.TypeOf(c.Error).Elem()), reflect.ValueOf(c.Error))
context.Set(reflect.ChanOf(reflect.SendDir, reflect.TypeOf(c.Disconnect).Elem()), reflect.ValueOf(c.Disconnect))
context.Set(reflect.ChanOf(reflect.RecvDir, reflect.TypeOf(c.Done).Elem()), reflect.ValueOf(c.Done))
}