Added support for hooks to customize behavior.

This commit is contained in:
Travis Reeder
2016-08-09 22:34:28 -07:00
parent 72a6d3aa5b
commit 8558d13f07
23 changed files with 324 additions and 42 deletions

View 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)
}