github.com/ashleymcnamara/buffalo@v0.8.0/context.go (about) 1 package buffalo 2 3 import ( 4 "context" 5 "net/http" 6 7 "github.com/gorilla/websocket" 8 9 "github.com/gobuffalo/buffalo/render" 10 ) 11 12 // Context holds on to information as you 13 // pass it down through middleware, Handlers, 14 // templates, etc... It strives to make your 15 // life a happier one. 16 type Context interface { 17 context.Context 18 Response() http.ResponseWriter 19 Request() *http.Request 20 Session() *Session 21 Params() ParamValues 22 Param(string) string 23 ParamInt(string) (int, error) 24 Set(string, interface{}) 25 Get(string) interface{} 26 LogField(string, interface{}) 27 LogFields(map[string]interface{}) 28 Logger() Logger 29 Bind(interface{}) error 30 Render(int, render.Renderer) error 31 Error(int, error) error 32 Websocket() (*websocket.Conn, error) 33 Redirect(int, string, ...interface{}) error 34 Data() map[string]interface{} 35 Flash() *Flash 36 } 37 38 // ParamValues will most commonly be url.Values, 39 // but isn't it great that you set your own? :) 40 type ParamValues interface { 41 Get(string) string 42 }