microsvc

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIBaseURI = "/api/"
)

Constants

Variables

View Source
var (
	HandlerPrefix = map[string]string{
		"Handler": "POST",
		"Handle":  "POST",
		"Get":     "GET",
		"Post":    "POST",
		"Put":     "PUT",
		"Patch":   "PATCH",
		"Delete":  "DELETE",
		"Option":  "OPTION",
		"Head":    "HEAD",
	}
	SkipControllerHanderNames = map[string]bool{
		"GetName":               true,
		"SetName":               true,
		"GetTopicCategory":      true,
		"SetTopicCategory":      true,
		"afterAnalyzedHandlers": true,
		"GetFilters":            true,
		"GetVisitors":           true,
		"GetObservers":          true,
		"GetDelegates":          true,
	}
)

global variables

Functions

func LoadAutoDocsHandler

func LoadAutoDocsHandler(app *iris.Application)

LoadAutoDocsHandler manually load docs handler

func LoadController

func LoadController(topicCategory string, controller Controller) error

LoadController load micro service controller as MQ consumer handlers and RESTful handlers

func LoadControllers

func LoadControllers(topicCategory string, controllers []Controller, app ...router.Party) error

LoadControllers load micro service controllers as MQ consumer handlers and RESTful handlers

func QueryMQ

func QueryMQ(topicCategory string, routingKey string, ctx SessionContext, param serializers.SerializableParam, response serializers.SerializableParam) error

QueryMQ with serializable parameter

func SetController

func SetController(name string, controller Controller)

SetController by controller name and controller instance

Types

type AbstractController

type AbstractController struct {
	filters.FiltersChain
	visitors.VisitorsChain
	observers.ObserversChain
	delegates.DelegatesChain
	// contains filtered or unexported fields
}

AbstractController base controller

func (*AbstractController) GetName

func (c *AbstractController) GetName() string

GetName controller name

func (*AbstractController) GetTopicCategory

func (c *AbstractController) GetTopicCategory() string

GetTopicCategory mq category

func (*AbstractController) HasConsumedMQ

func (c *AbstractController) HasConsumedMQ() bool

HasConsumedMQ boolean

func (*AbstractController) IsDisablesAuthorization

func (c *AbstractController) IsDisablesAuthorization() bool

IsDisablesAuthorization boolean

func (*AbstractController) SetConsumedMQ

func (c *AbstractController) SetConsumedMQ(consumed bool)

SetConsumedMQ boolean

func (*AbstractController) SetName

func (c *AbstractController) SetName(name string)

SetName mq category

func (*AbstractController) SetTopicCategory

func (c *AbstractController) SetTopicCategory(topicCategory string)

SetTopicCategory mq category

type Controller

type Controller interface {
	filters.FilterOperator
	visitors.VisitorOperator
	observers.ObserverOperator
	delegates.DelegateOperator
	GetName() string
	SetName(name string)
	GetTopicCategory() string
	SetTopicCategory(topicCategory string)
	IsDisablesAuthorization() bool
	HasConsumedMQ() bool
	SetConsumedMQ(consumed bool)
	// contains filtered or unexported methods
}

Controller interface

func GetController

func GetController(name string) Controller

GetController by controller name

func InitMQRegisterController

func InitMQRegisterController(topicCategory string) Controller

InitMQRegisterController for mq register

type HandlerError

type HandlerError interface {
	StatusCode() int
	Error() string
}

HandlerError handler execute error code

func NewHandlerError

func NewHandlerError(code int, message string) HandlerError

NewHandlerError HandlerError

type HandlerStatus

type HandlerStatus struct {
	Code    int
	Message string
}

HandlerStatus handler execute error code

func (*HandlerStatus) Error

func (he *HandlerStatus) Error() string

Error message

func (*HandlerStatus) StatusCode

func (he *HandlerStatus) StatusCode() int

Status code

type MQHandler

type MQHandler interface {
	autodocs.DocsHandler
	GetGroup() string
	GetName() string
	PreExecute(mqenv.MQConsumerMessage) *mqenv.MQPublishMessage
	Execute(mqenv.MQConsumerMessage) *mqenv.MQPublishMessage
	SetMQTopic(string)
	GetMQTopic() string
	GetController() Controller
	IsDisablesAuthorization() bool
}

MQHandler interface of mq handler

type MQHandlers

type MQHandlers interface {
	Execute(mqenv.MQConsumerMessage) *mqenv.MQPublishMessage
	RegisterHandlers(topicCategory string, hs map[string]MQHandler) error
	GetHandler(routingKey string) resthandlers.Handler
	AllDocHandlers() []autodocs.DocsHandler
}

MQHandlers interface of mq handler manager

func GetHandlers

func GetHandlers() MQHandlers

GetHandlers of loaded mq handlers

type SessionContext

type SessionContext struct {
	AppID                    string
	UserID                   string
	RequestSn                string
	CorrelationID            string
	ContentSerializationType string
}

SessionContext carries application info and user session info

func CreateSessionContextWithConsumerMessage

func CreateSessionContextWithConsumerMessage(msg mqenv.MQConsumerMessage) SessionContext

CreateSessionContextWithConsumerMessage SessionContext

func CreateSessionContextWithEvent

func CreateSessionContextWithEvent(event events.Event) SessionContext

CreateSessionContextWithEvent SessionContext

type StatusCodeResultType

type StatusCodeResultType interface {
	StatusCode() int
}

StatusCodeResultType interface

Jump to

Keyboard shortcuts

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