Documentation
¶
Index ¶
- Constants
- func Box2Http(b *B) http.Handler
- func GetError(ctx context.Context) error
- func GetRequest(ctx context.Context) *http.Request
- func GetResponse(ctx context.Context) http.ResponseWriter
- func SetError(ctx context.Context, err error)
- type A
- func Action(handler interface{}) *A
- func ActionPost(handler interface{}) *A
- func Connect(handler interface{}) *A
- func Delete(handler interface{}) *A
- func Get(handler interface{}) *A
- func Head(handler interface{}) *A
- func Options(handler interface{}) *A
- func Patch(handler interface{}) *A
- func Post(handler interface{}) *A
- func Put(handler interface{}) *A
- func Trace(handler interface{}) *A
- type Attr
- type B
- type C
- type E
- type H
- type I
- type R
Constants ¶
View Source
const ( AttrHttpMethod = "attr_http_method" AttrHttpBind = "attr_http_bind" AttrDoc = "attr_doc" )
Variables ¶
This section is empty.
Functions ¶
func GetResponse ¶
func GetResponse(ctx context.Context) http.ResponseWriter
Types ¶
type A ¶
type A struct {
Attr
HttpMethod string
// Name is the name to identify the action AND the invocation to url suffix
Name string
// Bound is true if this action is not an extended action
Bound bool
// Interceptors is the list of actions that will be executed before executing handler
Interceptors []I
// contains filtered or unexported fields
}
An A stands for Action
func ActionPost ¶
func ActionPost(handler interface{}) *A
func (*A) WithAttribute ¶
func (*A) WithInterceptors ¶
type Attr ¶
type Attr map[string]interface{}
func (Attr) GetAttribute ¶
Get Attribute value using key string from Box, Resource or Action.
func (Attr) SetAttribute ¶
Set Attribute key-value to Box, Resource or Action.
type C ¶
type C struct {
Resource *R
Action *A
Parameters map[string]string
// TODO: add headers
// TODO: add query
// TODO: add box
// TODO: ¿add marshaler and unmarshaler?
Request *http.Request
Response http.ResponseWriter
// contains filtered or unexported fields
}
An C is a box context to store box related thing in context such as *R, *A, *E, etc
type R ¶
type R struct {
Attr
// Path is a literal or placehoder that matches with a portion of the path
Path string
// Parent is a reference to parent resource
Parent *R
// Children is the list of desdendent resources
Children []*R
// Interceptors is the list of actions that will be executed before each
// action or resource under this resource
Interceptors []I
// contains filtered or unexported fields
}
R stands for Resource
func NewResource ¶
func NewResource() *R
func (*R) GetActions ¶ added in v0.1.0
GetActions retrieve the slice of actions defined in this resource
func (*R) WithAttribute ¶
func (*R) WithInterceptors ¶
Add interceptor to this resource
Source Files
¶
Click to show internal directories.
Click to hide internal directories.