github.com/sotirispl/buffalo@v0.11.1/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/binding"
    10  	"github.com/gobuffalo/buffalo/render"
    11  )
    12  
    13  // Context holds on to information as you
    14  // pass it down through middleware, Handlers,
    15  // templates, etc... It strives to make your
    16  // life a happier one.
    17  type Context interface {
    18  	context.Context
    19  	Response() http.ResponseWriter
    20  	Request() *http.Request
    21  	Session() *Session
    22  	Cookies() *Cookies
    23  	Params() ParamValues
    24  	Param(string) string
    25  	Set(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  	File(string) (binding.File, error)
    37  }
    38  
    39  // ParamValues will most commonly be url.Values,
    40  // but isn't it great that you set your own? :)
    41  type ParamValues interface {
    42  	Get(string) string
    43  }