switchcase

package
v1.6.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

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

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

Jump to

Keyboard shortcuts

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