github.com/bketelsen/buffalo@v0.9.5/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  	Cookies() *Cookies
    22  	Params() ParamValues
    23  	Param(string) string
    24  	Set(string, interface{})
    25  	LogField(string, interface{})
    26  	LogFields(map[string]interface{})
    27  	Logger() Logger
    28  	Bind(interface{}) error
    29  	Render(int, render.Renderer) error
    30  	Error(int, error) error
    31  	Websocket() (*websocket.Conn, error)
    32  	Redirect(int, string, ...interface{}) error
    33  	Data() map[string]interface{}
    34  	Flash() *Flash
    35  }
    36  
    37  // ParamValues will most commonly be url.Values,
    38  // but isn't it great that you set your own? :)
    39  type ParamValues interface {
    40  	Get(string) string
    41  }