const UsageContextKey = nullByteStr + "usage"
UsageContextKey is a special context key to get the route usage information within a handler.
This section is empty.
type Context interface { Set(string, interface{}) Get(string) interface{} }
Context is a context interface that gets passed to each ContextHandler.
type ContextHandler ¶ContextHandler is a siesta handler.
Compose composes multiple ContextHandlers into a single ContextHandler.
func ToContextHandler ¶ToContextHandler transforms f into a ContextHandler. f must be a function with one of the following signatures:
func(http.ResponseWriter, *http.Request) func(http.ResponseWriter, *http.Request, func()) func(Context, http.ResponseWriter, *http.Request) func(Context, http.ResponseWriter, *http.Request, func())
type EmptyContext struct{}
EmptyContext is a blank context.
Params represents a set of URL parameters from a request's query string. The interface is similar to a flag.FlagSet, but a) there is no usage string, b) there are no custom Var()s, and c) there are SliceXXX types. Sliced types support two ways of generating a multi-valued parameter: setting the parameter multiple times, and using a comma-delimited string. This adds the limitation that you can't have a value with a comma if in a Sliced type. Under the covers, Params uses flag.FlagSet.
Bool defines a bool param with specified name and default value. The return value is the address of a bool variable that stores the value of the param.
Duration defines a time.Duration param with specified name and default value. The return value is the address of a time.Duration variable that stores the value of the param.
Float64 defines a float64 param with specified name and default value. The return value is the address of a float64 variable that stores the value of the param.
Int defines an int param with specified name and default value. The return value is the address of an int variable that stores the value of the param.
Int64 defines an int64 param with specified name and default value. The return value is the address of an int64 variable that stores the value of the param.
Parse parses URL parameters from a http.Request.URL.Query(), which is a url.Values, which is just a map[string][string].
SliceBool defines a multi-value bool param with specified name and default value. The return value is the address of a SBool variable that stores the values of the param.
SliceDuration defines a multi-value time.Duration param with specified name and default value. The return value is the address of a SDuration variable that stores the values of the param.
SliceFloat64 defines a multi-value float64 param with specified name and default value. The return value is the address of a SFloat64 variable that stores the values of the param.
SliceInt defines a multi-value int param with specified name and default value. The return value is the address of a SInt variable that stores the values of the param.
SliceInt64 defines a multi-value int64 param with specified name and default value. The return value is the address of a SInt64 variable that stores the values of the param.
SliceString defines a multi-value string param with specified name and default value. The return value is the address of a SString variable that stores the values of the param.
SliceUint defines a multi-value uint param with specified name and default value. The return value is the address of a SUint variable that stores the values of the param.
SliceUint64 defines a multi-value uint64 param with specified name and default value. The return value is the address of a SUint64 variable that stores the values of the param.
String defines a string param with specified name and default value. The return value is the address of a string variable that stores the value of the param.
Uint defines a uint param with specified name and default value. The return value is the address of a uint variable that stores the value of the param.
Uint64 defines a uint64 param with specified name and default value. The return value is the address of a uint64 variable that stores the value of the param.
Usage returns a map keyed on parameter names. The map values are an array of name, type, and usage information for each parameter.
SBool is a slice of bool.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SDuration is a slice of time.Duration.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SFloat64 is a slice of float64.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SInt is a slice of int.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SInt64 is a slice of int64.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SString is a slice of string.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SUint is a slice of uint.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
SUint64 is a slice of uint64.
Set is the method to set the param value, part of the flag.Value interface. Set's argument is a string to be parsed to set the param. It's a comma-separated list, so we split it.
String is the method to format the param's value, part of the flag.Value interface. The String method's output will be used in diagnostics.
A Service is a container for routes with a common base URI. It also has two middleware chains, named "pre" and "post".
The "pre" chain is run before the main handler. The first handler in the "pre" chain is guaranteed to run, but execution may quit anywhere else in the chain.
If the "pre" chain executes completely, the main handler is executed. It is skipped otherwise.
The "post" chain runs after the main handler, whether it is skipped or not. The first handler in the "post" chain is guaranteed to run, but execution may quit anywhere else in the chain if the quit function is called.
NewService returns a new Service with the given base URI or panics if the base URI has already been registered.
func (s *Service) AddPost(f interface{})
AddPost adds f to the end of the "post" chain. It panics if f cannot be converted to a ContextHandler (see Service.Route).
func (s *Service) AddPre(f interface{})
AddPre adds f to the end of the "pre" chain. It panics if f cannot be converted to a ContextHandler (see Service.Route).
func (s *Service) DisableTrimSlash()
DisableTrimSlash disables the removal of trailing slashes before route matching.
Register registers s by adding it as a handler to the DefaultServeMux in the net/http package.
func (s *Service) Route(verb, uriPath, usage string, f interface{})
Route adds a new route to the Service. f must be a function with one of the following signatures:
func(http.ResponseWriter, *http.Request) func(http.ResponseWriter, *http.Request, func()) func(Context, http.ResponseWriter, *http.Request) func(Context, http.ResponseWriter, *http.Request, func())
Note that Context is an interface type defined in this package. The last argument is a function which is called to signal the quitting of the current execution sequence.
Service satisfies the http.Handler interface.
ServeHTTPInContext serves an HTTP request within the Context c. A Service will run through both of its internal chains, quitting when requested.
func (s *Service) SetNotFound(f interface{})
SetNotFound sets the handler for all paths that do not match any existing routes. It accepts the same function signatures that Route does with the addition of `nil`.
SetPostExecutionFunc sets a function that is executed at the end of every request. panicValue will be non-nil if a value was recovered after a panic.
type SiestaContext map[string]interface{}
SiestaContext is a concrete implementation of the siesta.Context interface. Typically this will be created by the siesta framework itself upon each request. However creating your own SiestaContext might be useful for testing to isolate the behavior of a single handler.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4