router

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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