router

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	//DefaultSenderIndex = 0
	RouterKeyName   = "router_key_name"
	RouterMatchType = "router_match_type"
	//RouterRoutesMap    = "router_routes"
	//RouterMatchValue   = "router_match_value"
	//RouterSenderIndex  = "router_sender_index"
	RouterDefaultIndex = "router_default_sender"

	MTypeEqualName    = "equal"
	MTypeContainsName = "contains"
)

Variables

View Source
var MatchTypeRegistry = map[string]MatchType{}

Functions

func GetRouterMatchTypeUsage

func GetRouterMatchTypeUsage() KeyValueSlice

func GetRouterOption

func GetRouterOption() []Option

Types

type MTypeContains

type MTypeContains struct{}

senderData 中包含

type MTypeEqual

type MTypeEqual struct{}

两个值完全相等

type MatchType

type MatchType func() mType

type Router

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

func NewSenderRouter

func NewSenderRouter(conf RouterConfig, senderCnt int) (*Router, error)

func (*Router) GetSenderIndex

func (r *Router) GetSenderIndex(data Data) int

func (*Router) HasRoutes added in v1.5.1

func (r *Router) HasRoutes() bool

HasRoutes 当有实际路由时返回 true,否则返回 false

type RouterConfig

type RouterConfig struct {
	KeyName      string         `json:"router_key_name"`
	MatchType    string         `json:"router_match_type"`
	DefaultIndex int            `json:"router_default_sender"`
	Routes       map[string]int `json:"router_routes"`
}

Jump to

Keyboard shortcuts

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