Documentation ¶
Overview ¶
Package switchcase provides chain elements acting like a switch-case statement, selecting a chain element with first succeed condition
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default(context.Context, *networkservice.Connection) bool
Default is a "default" case condition for switchcase
func NewClient ¶
func NewClient(cases ...*ClientCase) networkservice.NetworkServiceClient
NewClient returns a new switch-case client chain element
func NewServer ¶
func NewServer(cases ...*ServerCase) networkservice.NetworkServiceServer
NewServer returns a new switch-case server chain element
Types ¶
type ClientCase ¶
type ClientCase struct { Condition Condition Client networkservice.NetworkServiceClient }
ClientCase is a case type for the switch-case client chain element
type Condition ¶
type Condition = func(context.Context, *networkservice.Connection) bool
Condition is a type for switchcase.*Case condition
type ServerCase ¶
type ServerCase struct { Condition Condition Server networkservice.NetworkServiceServer }
ServerCase is a case type for the switch-case server chain element
Click to show internal directories.
Click to hide internal directories.