Documentation ¶
Index ¶
- func ParseID(val interface{}) uint
- func ParseString(val interface{}) string
- func ParseTime(val interface{}) *time.Time
- type ApiResponse
- type BaseAction
- type BaseController
- func (controller *BaseController) CustomActions() []*BaseAction
- func (controller *BaseController) Delete(r *BaseRequest)
- func (controller *BaseController) Get(r *BaseRequest)
- func (controller *BaseController) GetEditableFields() []string
- func (controller *BaseController) GetEntityParams(request *BaseRequest) map[string]interface{}
- func (controller *BaseController) GetList(request *BaseRequest) interface{}
- func (controller *BaseController) GetSingle(request *BaseRequest) interface{}
- func (controller *BaseController) GetWhere(request *BaseRequest) *Where
- func (controller *BaseController) Model() interface{}
- func (controller *BaseController) Name() string
- func (controller *BaseController) Orm() *orm.Orm
- func (controller *BaseController) Post(r *BaseRequest)
- func (controller *BaseController) Put(r *BaseRequest)
- func (controller *BaseController) RegisterAction(action *BaseAction)
- func (controller *BaseController) SpecializeRow(rawRow interface{}, data map[string]interface{}) interface{}
- type BaseControllerI
- type BaseHandle
- type BaseRequest
- func (b *BaseRequest) Body() []byte
- func (request *BaseRequest) GetFilterQuery() interface{}
- func (request *BaseRequest) GetFilterVars() []interface{}
- func (request *BaseRequest) GetID() string
- func (request *BaseRequest) GetParam(key string) string
- func (request *BaseRequest) SetError(value interface{})
- func (request *BaseRequest) SetErrorCode(errorCode int)
- func (request *BaseRequest) SetResponseBytes(b []byte)
- func (request *BaseRequest) SetValue(key string, value interface{})
- type Opts
- type Router
- func (this *Router) DELETE(path string, handle BaseHandle)
- func (this *Router) GET(path string, handle BaseHandle)
- func (this *Router) Listen(fork bool)
- func (r *Router) Opts() *Opts
- func (this *Router) POST(path string, handle BaseHandle)
- func (this *Router) PUT(path string, handle BaseHandle)
- func (this *Router) RegisterController(controller BaseControllerI)
- func (r *Router) Router() *httprouter.Router
- func (this *Router) ServeFiles(path string, filesDir string)
- func (r *Router) SetOpts(opts *Opts)
- type Where
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseString ¶
func ParseString(val interface{}) string
Types ¶
type ApiResponse ¶
type ApiResponse struct { jresp.JResp // contains filtered or unexported fields }
func NewResponse ¶
func NewResponse() *ApiResponse
func (*ApiResponse) SetErrorCode ¶
func (a *ApiResponse) SetErrorCode(errorCode int)
type BaseAction ¶
type BaseAction struct { Handle func(r *BaseRequest) Route string Method string }
func NewAction ¶
func NewAction(method string, handle func(r *BaseRequest), route string) *BaseAction
func (*BaseAction) FullRoute ¶
func (action *BaseAction) FullRoute(controller BaseControllerI, single bool) string
type BaseController ¶
type BaseController struct { ModelFn func() interface{} SpecializeRowFn func(rawRow interface{}, data map[string]interface{}) interface{} // contains filtered or unexported fields }
func NewController ¶
func NewController(orm *orm.Orm, name string) BaseController
func (*BaseController) CustomActions ¶
func (controller *BaseController) CustomActions() []*BaseAction
func (*BaseController) Delete ¶
func (controller *BaseController) Delete(r *BaseRequest)
func (*BaseController) Get ¶
func (controller *BaseController) Get(r *BaseRequest)
func (*BaseController) GetEditableFields ¶
func (controller *BaseController) GetEditableFields() []string
func (*BaseController) GetEntityParams ¶
func (controller *BaseController) GetEntityParams(request *BaseRequest) map[string]interface{}
Get parameters (lower case key => value map)
func (*BaseController) GetList ¶
func (controller *BaseController) GetList(request *BaseRequest) interface{}
func (*BaseController) GetSingle ¶
func (controller *BaseController) GetSingle(request *BaseRequest) interface{}
func (*BaseController) GetWhere ¶
func (controller *BaseController) GetWhere(request *BaseRequest) *Where
func (*BaseController) Model ¶
func (controller *BaseController) Model() interface{}
func (*BaseController) Name ¶
func (controller *BaseController) Name() string
func (*BaseController) Orm ¶
func (controller *BaseController) Orm() *orm.Orm
func (*BaseController) Post ¶
func (controller *BaseController) Post(r *BaseRequest)
func (*BaseController) Put ¶
func (controller *BaseController) Put(r *BaseRequest)
func (*BaseController) RegisterAction ¶
func (controller *BaseController) RegisterAction(action *BaseAction)
func (*BaseController) SpecializeRow ¶
func (controller *BaseController) SpecializeRow(rawRow interface{}, data map[string]interface{}) interface{}
type BaseControllerI ¶
type BaseControllerI interface { Name() string CustomActions() []*BaseAction Orm() *orm.Orm InitController() Model() interface{} }
type BaseHandle ¶
type BaseHandle func(*BaseRequest)
type BaseRequest ¶
type BaseRequest struct { Response http.ResponseWriter Request *http.Request Params httprouter.Params // contains filtered or unexported fields }
func (*BaseRequest) Body ¶
func (b *BaseRequest) Body() []byte
func (*BaseRequest) GetFilterQuery ¶
func (request *BaseRequest) GetFilterQuery() interface{}
func (*BaseRequest) GetFilterVars ¶
func (request *BaseRequest) GetFilterVars() []interface{}
func (*BaseRequest) GetID ¶
func (request *BaseRequest) GetID() string
func (*BaseRequest) GetParam ¶
func (request *BaseRequest) GetParam(key string) string
func (*BaseRequest) SetError ¶
func (request *BaseRequest) SetError(value interface{})
Set response error
func (*BaseRequest) SetErrorCode ¶
func (request *BaseRequest) SetErrorCode(errorCode int)
func (*BaseRequest) SetResponseBytes ¶
func (request *BaseRequest) SetResponseBytes(b []byte)
func (*BaseRequest) SetValue ¶
func (request *BaseRequest) SetValue(key string, value interface{})
Set response value
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) DELETE ¶
func (this *Router) DELETE(path string, handle BaseHandle)
func (*Router) GET ¶
func (this *Router) GET(path string, handle BaseHandle)
func (*Router) POST ¶
func (this *Router) POST(path string, handle BaseHandle)
func (*Router) PUT ¶
func (this *Router) PUT(path string, handle BaseHandle)
func (*Router) RegisterController ¶
func (this *Router) RegisterController(controller BaseControllerI)
func (*Router) Router ¶
func (r *Router) Router() *httprouter.Router
func (*Router) ServeFiles ¶
Click to show internal directories.
Click to hide internal directories.