Documentation
¶
Index ¶
- Constants
- type Action
- type ActionFunc
- type Context
- type Header
- type Middleware
- type Request
- type RequestCtx
- type Response
- type Route
- type Server
- func (s *Server) AddAuthMiddleware(m Middleware)
- func (s *Server) AddFuncRoute(f ActionFunc, secure bool) (*Route, error)
- func (s *Server) AddMiddleware(m Middleware)
- func (s *Server) AddQueryRoute(path, query, params string, secure bool) (*Route, error)
- func (s *Server) Connect() error
- func (s *Server) Database() *db.Connection
- func (s *Server) Execute(method, url, header, body []byte) (Response, error)
- func (s *Server) GetRoute(method, path string) (*Route, error)
- func (s *Server) NormalizeFunc(n bool)
- func (s *Server) OpenDatabase(host string, port int, username, password, name string) error
- func (s *Server) Serve(port int) error
- func (s *Server) SetDatabase(host string, port int, username, password, name string)
- func (s *Server) SetDebug()
- func (s *Server) SetLogger(debug func(v ...interface{}), warn func(v ...interface{}), ...)
- func (s *Server) SetProduction()
- func (s *Server) SetRoute(route *Route)
- type Session
Constants ¶
View Source
const ( //MethodGet GET MethodGet string = `GET` //MethodPost POST MethodPost string = `POST` //StatusBadRequest ... StatusBadRequest = 400 StatusUnauthorized = 401 //StatusNotFound ... StatusNotFound = 404 //StatusOK ... StatusOK = 200 //StatusInternalServerError ... StatusInternalServerError = 500 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestCtx ¶
type RequestCtx interface {
Header() Header
Body() []byte
URL() url.URL
Session() Session
Tx() *db.Tx
}
RequestCtx ..
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route ...
func (*Route) AddFuncAction ¶
func (r *Route) AddFuncAction(f ActionFunc, property string) (Action, error)
AddFuncAction ...
func (*Route) AddQueryAction ¶
AddQueryAction ...
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server ...
func (*Server) AddAuthMiddleware ¶
func (s *Server) AddAuthMiddleware(m Middleware)
AddAuthMiddleware ..
func (*Server) AddFuncRoute ¶ added in v0.3.2
func (s *Server) AddFuncRoute(f ActionFunc, secure bool) (*Route, error)
AddFuncRoute add route with single func action. When secure is true, this route will validated using auth middlewares if any.
func (*Server) AddQueryRoute ¶ added in v0.3.2
AddQueryRoute add route with single query action. When secure is true, this route will validated using auth middlewares if any.
func (*Server) NormalizeFunc ¶ added in v0.3.2
NormalizeFunc if yes from this and beyond all Func added will renamed to lowercase, separated with underscore. Ex: HelloWorld registered as hello_world
func (*Server) OpenDatabase ¶
OpenDatabase call SetDatabase and Connect
func (*Server) SetDatabase ¶
SetDatabase ...
Source Files
¶
Click to show internal directories.
Click to hide internal directories.