Documentation ¶
Index ¶
- Constants
- Variables
- func NewDefaultRouter() *defaultRouter
- type Action
- type Cork
- type DefaultAction
- type Dispatcher
- type Error
- type Handler
- type HandlerExpression
- type HandlerFunc
- type HandlerWithExpression
- type Message
- func (m *Message) Next()
- func (m *Message) Return(status int, payload interface{})
- func (m *Message) ReturnError(status int, err error)
- func (m *Message) ReturnOK(payload interface{})
- func (m *Message) ReturnServerError(err error)
- func (m *Message) ReturnStatus(status int)
- func (m *Message) SetRoute(route *Route)
- type MessageCreator
- type Route
- type Router
- type Routes
- type Segment
- type Services
- type SettingsHandler
- type WithExpression
Constants ¶
View Source
const ( GET string = "GET" POST string = "POST" PATCH string = "PATCH" DELETE string = "DELETE" PUT string = "PUT" )
View Source
const ROOT_ROUTE = "/"
Variables ¶
View Source
var ErrorHandler = func(message *Message) {
message.ReturnStatus(message.Error.Status)
}
Functions ¶
func NewDefaultRouter ¶
func NewDefaultRouter() *defaultRouter
Types ¶
type Cork ¶
type DefaultAction ¶
type DefaultAction struct{}
func (DefaultAction) Create ¶
func (a DefaultAction) Create(action interface{}) Handler
type Dispatcher ¶
type Dispatcher interface { http.Handler SettingsHandler }
type HandlerExpression ¶
type HandlerExpression interface { Handle(Handler) HandlerWithExpression HandleFunc(func(*Message)) HandlerWithExpression }
type HandlerFunc ¶
type HandlerFunc func(*Message)
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(message *Message)
type HandlerWithExpression ¶
type HandlerWithExpression interface { HandlerExpression WithExpression }
type Message ¶
type Message struct { *http.Request Response http.ResponseWriter Route *Route Context interface{} Params map[string]string Error *Error Settings *Cork // contains filtered or unexported fields }
func (*Message) ReturnError ¶
func (*Message) ReturnServerError ¶
func (*Message) ReturnStatus ¶
type MessageCreator ¶
type Route ¶
type Routes ¶
type Routes interface { Get(template string, action interface{}) HandlerWithExpression Forward(prefix string, routes func(r Routes)) }
type Services ¶
type Services struct { Dispatcher Dispatcher Router Router Action Action MessageCreator MessageCreator }
func NewServices ¶
func NewServices() *Services
type SettingsHandler ¶
type SettingsHandler interface {
Configure(cork *Cork)
}
type WithExpression ¶
type WithExpression interface {
WithContext(interface{})
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.