mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Added support for hooks to customize behavior.
This commit is contained in:
28
api/server/special_handler_context.go
Normal file
28
api/server/special_handler_context.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
)
|
||||
|
||||
type SpecialHandlerContext struct {
|
||||
server *Server
|
||||
ginContext *gin.Context
|
||||
}
|
||||
|
||||
func (c *SpecialHandlerContext) Request() *http.Request {
|
||||
return c.ginContext.Request
|
||||
}
|
||||
|
||||
func (c *SpecialHandlerContext) Datastore() models.Datastore {
|
||||
return c.server.Datastore
|
||||
}
|
||||
|
||||
func (c *SpecialHandlerContext) Set(key string, value interface{}) {
|
||||
c.ginContext.Set(key, value)
|
||||
}
|
||||
func (c *SpecialHandlerContext) Get(key string) (value interface{}, exists bool) {
|
||||
return c.ginContext.Get(key)
|
||||
}
|
||||
Reference in New Issue
Block a user