Documentation ¶
Index ¶
- Variables
- func IsNil(plan Plan) bool
- func ToHeader(params Params, route ...string) string
- type CallData
- type Controller
- type Default
- type HandleOptions
- type Handler
- type Operator
- type Options
- func AJAX() Options
- func Always() Options
- func Call(calls ...string) Options
- func Command(commands ...wit.Command) Options
- func Delete() Options
- func Do(fn func(r ReadOnlyRequest)) Options
- func Excl() Options
- func Fork(fn func(o Options) Plan) Options
- func Get() Options
- func Handle(fn func(r Request) wit.Command) Options
- func Method(methods ...string) Options
- func Navigation() Options
- func NoCall(calls ...string) Options
- func NoDelete() Options
- func NoGet() Options
- func NoMethod(methods ...string) Options
- func NoPatch() Options
- func NoPost() Options
- func NoPut() Options
- func NoSocket() Options
- func Patch() Options
- func Post() Options
- func Put() Options
- func Run(fn func(r Request) wit.Command) Options
- func Socket() Options
- func Sync() Options
- func Tap(fn func(r ReadOnlyRequest)) Options
- func With(params ...string) Options
- func (o Options) AJAX() Options
- func (o Options) Always() Options
- func (o Options) Call(calls ...string) Options
- func (o Options) Command(commands ...wit.Command) Options
- func (o Options) Delete() Options
- func (o Options) Do(fn func(r ReadOnlyRequest)) Options
- func (o Options) Excl() Options
- func (o Options) Fork(fn func(o Options) Plan) Options
- func (o Options) Get() Options
- func (o Options) Handle(fn func(r Request) wit.Command) Options
- func (o Options) Method(methods ...string) Options
- func (o Options) Navigation() Options
- func (o Options) NoCall(calls ...string) Options
- func (o Options) NoDelete() Options
- func (o Options) NoGet() Options
- func (o Options) NoMethod(methods ...string) Options
- func (o Options) NoPatch() Options
- func (o Options) NoPost() Options
- func (o Options) NoPut() Options
- func (o Options) NoSocket() Options
- func (o Options) Patch() Options
- func (o Options) Pipe(operators ...Operator) Options
- func (o Options) Post() Options
- func (o Options) Procedure() Procedure
- func (o Options) Put() Options
- func (o Options) Run(fn func(r Request) wit.Command) Options
- func (o Options) Socket() Options
- func (o Options) Sync() Options
- func (o Options) Tap(fn func(r ReadOnlyRequest)) Options
- func (o Options) With(params ...string) Options
- type Params
- type Plan
- type Procedure
- type ReadOnlyRequest
- type Request
- func (r Request) ChangeParams(modifier func(Params))
- func (r Request) ContextVary(headers ...string)
- func (r Request) Handle(o HandleOptions) (wit.Command, func())
- func (r Request) HandleBody(f func(http.ResponseWriter))
- func (r Request) HandleResponse(f func(http.ResponseWriter))
- func (r Request) Load(dependencies ...string)
- func (r Request) MaxBytesReader(rc io.ReadCloser, n int64) io.ReadCloser
- func (r Request) ParamsRedirect(params Params)
- func (r Request) ParamsURLRedirect(statusCode int, params way.Params) error
- func (r Request) PartialRedirect(params Params, route ...string)
- func (r Request) PartialURLRedirect(statusCode int, params way.Params, route ...string) error
- func (r Request) Redirect(params Params, route ...string)
- func (r Request) ServeContent(name string, modtime time.Time, content io.ReadSeeker)
- func (r Request) ServeFile(name string)
- func (r Request) SetCookie(cookie *http.Cookie)
- func (r Request) URLRedirect(statusCode int, params way.Params, route ...string) error
- func (r Request) UseCustomBody(reader io.Reader)
- func (r Request) UseEmptyBody()
- func (r Request) Vary(headers ...string)
- type StatusCodeGetterSetter
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{}
DefaultOptions are the options which apply to plans by default
Functions ¶
Types ¶
type Controller ¶
type Controller interface { Plan() Plan Resolve(string) Controller }
Controller represents a controller of the routing tree
type Default ¶
type Default struct{}
Default implements the default controller
func (Default) Resolve ¶
func (controller Default) Resolve(id string) Controller
Resolve returns the nth child of this controller
type HandleOptions ¶
type HandleOptions struct { Root Controller HeaderName string Route []string Params }
HandleOptions wraps request.Handle options
type Handler ¶
type Handler struct { Root func() Controller RootName string RouteHeader string DepsHeader string InstanceIDHeader string InputBuffer int websocket.Upgrader way.Router }
Handler implements an HTTP handler which provides wok requests
type Operator ¶
Operator represents an entity capable of applying transformations to certain options
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options holds the list of options selected for a given plan
func Do ¶
func Do(fn func(r ReadOnlyRequest)) Options
Do does something with the request without returning a delta
func Excl ¶
func Excl() Options
Excl runs plans exclusively, no other plan is allowed to run at the same time
func Tap ¶
func Tap(fn func(r ReadOnlyRequest)) Options
Tap does something with the request without returning a delta
func (Options) Do ¶
func (o Options) Do(fn func(r ReadOnlyRequest)) Options
Do always does something with the request without returning a delta
func (Options) Navigation ¶
Navigation runs plans on navigation
func (Options) NoCall ¶
NoCall runs this plan when the request doesn't match one of the provided calls
func (Options) NoMethod ¶
NoMethod runs this plan when the request doesn't match one of the provided methods
func (Options) Tap ¶
func (o Options) Tap(fn func(r ReadOnlyRequest)) Options
Tap does something with the request without returning a delta
type Procedure ¶
type Procedure struct {
// contains filtered or unexported fields
}
Procedure describes how to handle a certain request
type ReadOnlyRequest ¶
type ReadOnlyRequest struct { *http.Request context.Context *sync.Mutex way.Router url.Values InstanceID string OldParams url.Values IsSocket bool InitialLoad bool Call CallData Input <-chan url.Values Output chan<- wit.Command RequestHeader http.Header }
ReadOnlyRequest wraps a read-only HTTP request
func (ReadOnlyRequest) ClientID ¶
func (r ReadOnlyRequest) ClientID() string
ClientID returns InstanceID, useful to meet interface definitions
func (ReadOnlyRequest) CmdCh ¶
func (r ReadOnlyRequest) CmdCh() chan<- wit.Command
CmdCh returns Output, useful to meet interface definitions
func (ReadOnlyRequest) FromHeader ¶
func (r ReadOnlyRequest) FromHeader(header string) (Params, []string)
FromHeader builds a route path from an HTTP header
type Request ¶
type Request struct { ReadOnlyRequest *StatusCodeGetterSetter ResponseHeader http.Header // contains filtered or unexported fields }
Request wraps an HTTP request
func (Request) ChangeParams ¶
ChangeParams applies a modifier function to the full parameters of this request
func (Request) ContextVary ¶
ContextVary adds several headers to the Vary header, for the duration of this context
func (Request) Handle ¶
func (r Request) Handle(o HandleOptions) (wit.Command, func())
Handle executes the appropiate plans and gathers returned commands
func (Request) HandleBody ¶
func (r Request) HandleBody(f func(http.ResponseWriter))
HandleBody tells the controller how to handle the response body
func (Request) HandleResponse ¶
func (r Request) HandleResponse(f func(http.ResponseWriter))
HandleResponse tells the controller how to handle the response
func (Request) MaxBytesReader ¶
func (r Request) MaxBytesReader(rc io.ReadCloser, n int64) io.ReadCloser
MaxBytesReader limits the size of a reader
func (Request) ParamsRedirect ¶
ParamsRedirect issues an internal redirection changing only route parameters
func (Request) ParamsURLRedirect ¶
ParamsURLRedirect issues an HTTP redirection changing only route parameters
func (Request) PartialRedirect ¶
PartialRedirect issues an internal redirection at the current controller, starting from the current route level
func (Request) PartialURLRedirect ¶
PartialURLRedirect issues an HTTP redirection starting from the current route level
func (Request) ServeContent ¶
ServeContent replies to the request using the content in the provided ReadSeeker
func (Request) ServeFile ¶
ServeFile replies to the request with the contents of the named file or directory
func (Request) SetCookie ¶
SetCookie adds a Set-Cookie header to the provided ResponseWriter's headers
func (Request) URLRedirect ¶
URLRedirect issues an HTTP redirection
func (Request) UseCustomBody ¶
UseCustomBody tells the controller to send the provided reader as the response of this request
func (Request) UseEmptyBody ¶
func (r Request) UseEmptyBody()
UseEmptyBody tells the controller to send an empty body as the response of this request
type StatusCodeGetterSetter ¶
type StatusCodeGetterSetter struct {
// contains filtered or unexported fields
}
StatusCodeGetterSetter holds a status code in a concurrent-safe way
func (*StatusCodeGetterSetter) SetStatusCode ¶
func (sc *StatusCodeGetterSetter) SetStatusCode(statusCode int)
SetStatusCode sets the internal status code
func (*StatusCodeGetterSetter) StatusCode ¶
func (sc *StatusCodeGetterSetter) StatusCode() int
StatusCode retrieves the internal status code