Documentation ¶
Index ¶
- Constants
- type Action
- type ActionsHandler
- type Context
- func (context *Context) Join(room string)
- func (context *Context) Leave(room string)
- func (context *Context) Params(key string) interface{}
- func (context *Context) ParamsFloat64(key string, fallback float64) float64
- func (context *Context) ParamsInt(key string, fallback int) int
- func (context *Context) ParamsStr(key string) string
- func (context *Context) Property(key string) interface{}
- func (context *Context) Rooms() []string
- func (context *Context) SetErrorResult(status string, err error)
- func (context *Context) SetProperty(key string, value interface{})
- func (context *Context) SetSuccessResult(content interface{})
- func (context *Context) SingleJoin(room string)
- type Controllable
- type ControllerHandler
- type ErrorsView
- type Event
- type Hook
- type HooksHandler
- type Manager
- type NetworkError
- 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 Action ¶ added in v0.0.21
type Action func(*Context)
Action is alias for func(*Connection) (interface{}, error)
type ActionsHandler ¶
type ActionsHandler struct {
// contains filtered or unexported fields
}
ActionsHandler used to mange callbacks for controllers
func (*ActionsHandler) RegisterAction ¶ added in v0.0.21
func (handler *ActionsHandler) RegisterAction(actionName string, action Action)
RegisterAction used to register action
func (*ActionsHandler) RegisterConnectedAction ¶ added in v0.0.37
func (handler *ActionsHandler) RegisterConnectedAction(action Action)
RegisterConnectedAction used to register connected action
func (*ActionsHandler) RegisterDisconnectedAction ¶ added in v0.0.37
func (handler *ActionsHandler) RegisterDisconnectedAction(action Action)
RegisterDisconnectedAction used to register disconnected action
func (*ActionsHandler) RegisterErrorAction ¶ added in v0.0.37
func (handler *ActionsHandler) RegisterErrorAction(action Action)
RegisterErrorAction used to register error action
type Context ¶ added in v0.0.21
type Context struct {
// contains filtered or unexported fields
}
Context used to represent context with properties and params
func (*Context) ParamsFloat64 ¶ added in v0.0.62
ParamsFloat64 used to retrieve params value in float64
func (*Context) SetErrorResult ¶ added in v0.0.60
SetErrorResult used to halt controller's chain and acknowledge request with status and error
func (*Context) SetProperty ¶ added in v0.0.21
SetProperty used to set property that can used across the context
func (*Context) SetSuccessResult ¶ added in v0.0.60
func (context *Context) SetSuccessResult(content interface{})
SetSuccessResult used to halt controller's chain and acknowledge request with content
func (*Context) SingleJoin ¶ added in v0.0.21
SingleJoin used to join socketio room while leaving other joined rooms
type Controllable ¶ added in v0.0.21
type Controllable interface {
RegisterHooksAndActions(*HooksHandler, *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 ErrorsView ¶ added in v0.0.21
type ErrorsView struct {
Messages string
}
ErrorsView is view template for controller errors
type Event ¶ added in v0.0.21
type Event struct {
// contains filtered or unexported fields
}
Event used as medium of communication
type HooksHandler ¶ added in v0.0.21
type HooksHandler struct {
// contains filtered or unexported fields
}
HooksHandler used to mange callbacks for controllers
func (*HooksHandler) RegisterBeforeActionHook ¶ added in v0.0.39
func (handler *HooksHandler) RegisterBeforeActionHook(beforeActionHook Hook)
RegisterBeforeActionHook used to add before hook
type Manager ¶ added in v0.0.21
type Manager struct {
// contains filtered or unexported fields
}
Manager is singleton manager for controller module
func (*Manager) BroadcastEvent ¶ added in v0.0.21
func (manager *Manager) BroadcastEvent(nsp string, room string, eventName string, view interface{}, parameters helpers.H)
BroadcastEvent used to broadcast event
func (*Manager) RegisterController ¶ added in v0.0.21
func (manager *Manager) RegisterController(nsp string, controllable Controllable)
RegisterController used to register controller
type NetworkError ¶
NetworkError encapsulates network error with status code and error message
type Result ¶ added in v0.0.57
type Result struct {
// contains filtered or unexported fields
}
Result used to wrap request result
func (*Result) Content ¶ added in v0.0.57
func (result *Result) Content() interface{}
Content used to retrieve result's content
func (*Result) ErrorMessage ¶ added in v0.0.57
ErrorMessage used to retrieve result's error message
func (*Result) StatusError ¶ added in v0.0.57
StatusError used to check if request is errored
func (*Result) StatusSuccess ¶ added in v0.0.57
StatusSuccess used to check if request is success
func (*Result) StatusUnauthorized ¶ added in v0.0.57
StatusUnauthorized used to check if request is unauthorized