router

package
v0.0.0-...-c0cfcfc Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldsArrayEquals

func FieldsArrayEquals(a PatternFields, b PatternFields) bool

FieldsArrayEquals check if b is subset of a

Types

type Bucket

type Bucket struct {
	PatternSets PatternSets
	Weight      int
}

type PatternFieldValue

type PatternFieldValue interface{}

type PatternFields

type PatternFields map[string]PatternFieldValue

type PatternSet

type PatternSet struct {
	Pattern interface{}
	Weight  int
	Fields  PatternFields
	Payload interface{}
}

type PatternSets

type PatternSets []*PatternSet

type Router

type Router struct {
	Map     *hashmap.Map
	Buckets []*Bucket
	IsDeep  bool
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(IsDeep bool) *Router

NewRouter creaet a new router

func (*Router) Add

func (r *Router) Add(pattern, payload interface{})

Add Insert a new pattern

func (*Router) List

func (r *Router) List() PatternSets

func (*Router) Lookup

func (r *Router) Lookup(p interface{}) *PatternSet

Lookup Search for a specific pattern and returns it

Jump to

Keyboard shortcuts

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