router

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handle(request Request) (interface{}, error)
}

Handler is an interface that must be implemented by any action handler

type Request

type Request struct {
	Command,
	Token string
	Data interface{}
}

Request is a request object from the main server

func (*Request) GetAction

func (r *Request) GetAction() string

GetAction returns action to handle

func (*Request) GetModule

func (r *Request) GetModule() string

GetModule returns module that should hanlde the request

type Response

type Response struct {
	Status,
	Error string
	Data interface{}
}

Response that will be sent to the mail server

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router contains handlers to handle requests

func (*Router) GetHandler

func (r *Router) GetHandler(request Request) Handler

GetHandler returns module handler

func (*Router) HandleRequest

func (r *Router) HandleRequest(request Request) (interface{}, error)

HandleRequest handles request

func (*Router) RegisterHandler

func (r *Router) RegisterHandler(module string, handler Handler)

RegisterHandler register module handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL