Documentation ¶
Index ¶
- Constants
- Variables
- func AddFilter(f func(ResponseWriter, Request) (bool, error))
- func AddPostProc(f func(ResponseWriter, Request, error) (bool, error))
- func CORSHeaders(w http.ResponseWriter)
- func Copy(dest interface{}, r Request, method string) error
- func CopyBytes(dest interface{}, r Request, b []byte, method string) error
- func DumpJava(dir string, classes map[string]string) error
- func GenerateJava(pkg string) (map[string]string, error)
- func HTTPError(w http.ResponseWriter, r *http.Request, err error)
- func Handle(ro *mux.Router, pattern string, methods []string, routeName string, ...)
- func HandleError(w http.ResponseWriter, r Request, err error)
- func HandleResource(ro *mux.Router, re *Resource)
- func HeadCallback(f func(*Node) error)
- func Media(r *http.Request, header string) (media, charset string)
- func SetJSONFormURL(u *url.URL)
- func SetJSVURL(u *url.URL)
- func VersionETagCache(handler func(ResponseWriter, Request) error) func(ResponseWriter, Request) error
- type Content
- type DocField
- type DocType
- type HTTPErr
- type Item
- type Itemer
- type JSONSchema
- type Link
- type LinkDecorator
- type Links
- type List
- type Lister
- type Method
- type Node
- type Properties
- type Request
- type Resource
- type ResponseWriter
Constants ¶
View Source
const (
DateTimeInputFormat = "2006-01-02T15:04"
)
Variables ¶
View Source
var ( // DefaultScheme is used to construct URLs, not to match them, since App Engine forwards HTTPS requests as HTTP requests. DefaultScheme = "http" CORSAllowHeaders = []string{"Content-Type", "Accept", "Authorization"} )
Functions ¶
func AddFilter ¶
func AddFilter(f func(ResponseWriter, Request) (bool, error))
Filters are run before the request handlers, and any filter returning false or an error will stop the handler from running. Returned errors will get forwarded to the client.
func AddPostProc ¶
func AddPostProc(f func(ResponseWriter, Request, error) (bool, error))
PostProcs are run in sequence after the request handler. The first proc receives the error returned by the handler, and all consecutive procs get the error returned by the previous proc. Any proc returning false will stop further procs from running. The final returned error will be forwarded to the client.
func CORSHeaders ¶
func CORSHeaders(w http.ResponseWriter)
func HandleError ¶
func HandleError(w http.ResponseWriter, r Request, err error)
func HandleResource ¶
func HeadCallback ¶
func SetJSONFormURL ¶
func VersionETagCache ¶ added in v0.1.5
func VersionETagCache(handler func(ResponseWriter, Request) error) func(ResponseWriter, Request) error
Types ¶
type DocField ¶
func (DocField) ToJSONSchema ¶
func (d DocField) ToJSONSchema() (*JSONSchema, error)
type DocType ¶
type DocType struct { Kind string Name string Elem *DocType Fields []DocField // contains filtered or unexported fields }
func (DocType) ToJSONSchema ¶
func (d DocType) ToJSONSchema() (*JSONSchema, error)
type Item ¶
func (Item) MarshalJSON ¶
type JSONSchema ¶
type JSONSchema struct { Type string `json:"type"` Properties map[string]JSONSchema `json:"properties,omitempty"` AdditionalProperties *JSONSchema `json:"additionalProperties,omitempty"` Items *JSONSchema `json:"items,omitempty"` Title string `json:"title,omitempty"` }
type Link ¶
type Link struct { Rel string Route string URL string RouteParams []string QueryParams url.Values Method string Type reflect.Type Render bool // contains filtered or unexported fields }
func (Link) MarshalJSON ¶
type Properties ¶
type Properties interface{}
type Resource ¶
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter SetContent(Content) }
Click to show internal directories.
Click to hide internal directories.