Documentation
¶
Index ¶
- Constants
- type Action
- type ActionsHandler
- func (handler *ActionsHandler) RegisterAction(actionName string, action Action)
- func (handler *ActionsHandler) RegisterBeforeActionHook(hook Hook, onlys []string)
- func (handler *ActionsHandler) RegisterConnectedAction(action Action)
- func (handler *ActionsHandler) RegisterDisconnectedAction(action Action)
- func (handler *ActionsHandler) RegisterErrorAction(action Action)
- type Context
- func (context *Context) Join(room string)
- func (context *Context) Leave(room string)
- func (context *Context) Param(key string) interface{}
- func (context *Context) ParamBool(key string) bool
- func (context *Context) ParamDict(key string) *helpers.Dictionary
- func (context *Context) ParamFloat64(key string, fallback float64) float64
- func (context *Context) ParamH(key string) helpers.H
- func (context *Context) ParamInt(key string, fallback int) int
- func (context *Context) ParamStr(key string) string
- func (context *Context) PrepareRender(viewName string) *views.Renderer
- func (context *Context) Property(key string) interface{}
- func (context *Context) QueryStr(key string) string
- func (context *Context) Rooms() []string
- func (context *Context) SetErrorResult(err error)
- func (context *Context) SetProperty(key string, value interface{})
- func (context *Context) SetSuccessResult(content interface{})
- func (context *Context) SetUnauthorizedResult()
- func (context *Context) SingleJoin(room string)
- type Controllable
- type ControllerHandler
- type Event
- type Hook
- type Manager
- func (manager *Manager) BroadcastEvent(nsp string, room string, eventName string, view interface{}, ...)
- func (manager *Manager) RegisterController(nsp string, controllable Controllable)
- func (manager *Manager) Serve(port string, httpHandler func())
- func (manager *Manager) Setup(viewsManager *views.Manager)
- type Result
- func (result *Result) Content() interface{}
- func (result *Result) ErrorMessage() string
- func (result *Result) Set(content interface{}, status string, err error)
- func (result *Result) Status() string
- func (result *Result) StatusError() bool
- func (result *Result) StatusSuccess() bool
- func (result *Result) StatusUnauthorized() bool
Constants ¶
const StatusError = "error"
StatusError used to represent errored request
const StatusInternalServerError = "internalservererror"
StatusInternalServerError used to represent unhandled exception request
const StatusSuccess = "success"
StatusSuccess used to represent success request
StatusUnauthorized used to represent unauthorized request
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionsHandler ¶
type ActionsHandler struct {
// contains filtered or unexported fields
}
ActionsHandler used to mange callbacks for controllers
func (*ActionsHandler) RegisterAction ¶
func (handler *ActionsHandler) RegisterAction(actionName string, action Action)
RegisterAction used to register action
func (*ActionsHandler) RegisterBeforeActionHook ¶ added in v1.0.8
func (handler *ActionsHandler) RegisterBeforeActionHook(hook Hook, onlys []string)
RegisterBeforeActionHook used to add before hook
func (*ActionsHandler) RegisterConnectedAction ¶
func (handler *ActionsHandler) RegisterConnectedAction(action Action)
RegisterConnectedAction used to register connected action
func (*ActionsHandler) RegisterDisconnectedAction ¶
func (handler *ActionsHandler) RegisterDisconnectedAction(action Action)
RegisterDisconnectedAction used to register disconnected action
func (*ActionsHandler) RegisterErrorAction ¶
func (handler *ActionsHandler) RegisterErrorAction(action Action)
RegisterErrorAction used to register error action
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context used to represent context with properties and params
func (*Context) ParamDict ¶ added in v1.0.81
func (context *Context) ParamDict(key string) *helpers.Dictionary
ParamDict used to retrieve params value in dict
func (*Context) ParamFloat64 ¶ added in v1.0.81
ParamFloat64 used to retrieve params value in float64
func (*Context) PrepareRender ¶
func (*Context) SetErrorResult ¶
SetErrorResult used to halt controller's chain and acknowledge request with error status and error
func (*Context) SetProperty ¶
SetProperty used to set property that can used across the context
func (*Context) SetSuccessResult ¶
func (context *Context) SetSuccessResult(content interface{})
SetSuccessResult used to halt controller's chain and acknowledge request with content
func (*Context) SetUnauthorizedResult ¶ added in v1.0.76
func (context *Context) SetUnauthorizedResult()
SetUnauthorizedResult used to halt controller's chain and acknowledge request with unthorized status
func (*Context) SingleJoin ¶
SingleJoin used to join socketio room while leaving other joined rooms
type Controllable ¶
type Controllable interface {
RegisterActions(*ActionsHandler)
}
Controllable is the interface for all controllers implementing RegisterBeforeHooks and RegisterActions
type ControllerHandler ¶
type ControllerHandler struct {
// contains filtered or unexported fields
}
ControllerHandler used to handle controller
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event used as medium of communication
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is singleton manager for controller module
func (*Manager) BroadcastEvent ¶
func (manager *Manager) BroadcastEvent(nsp string, room string, eventName string, view interface{}, parameters helpers.H)
BroadcastEvent used to broadcast event
func (*Manager) RegisterController ¶
func (manager *Manager) RegisterController(nsp string, controllable Controllable)
RegisterController used to register controller
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result used to wrap request result
func (*Result) Content ¶
func (result *Result) Content() interface{}
Content used to retrieve result's content
func (*Result) ErrorMessage ¶
ErrorMessage used to retrieve result's error message
func (*Result) StatusError ¶
StatusError used to check if request is errored
func (*Result) StatusSuccess ¶
StatusSuccess used to check if request is success
func (*Result) StatusUnauthorized ¶
StatusUnauthorized used to check if request is unauthorized