MCPcopy Create free account
hub / github.com/CPChain/chain / isPubSub

Function isPubSub

api/rpc/utils.go:87–96  ·  view source on GitHub ↗

isPubSub tests whether the given method has as as first argument a context.Context and returns the pair (Subscription, error)

(methodType reflect.Type)

Source from the content-addressed store, hash-verified

85// isPubSub tests whether the given method has as as first argument a context.Context
86// and returns the pair (Subscription, error)
87func isPubSub(methodType reflect.Type) bool {
88 // numIn(0) is the receiver type
89 if methodType.NumIn() < 2 || methodType.NumOut() != 2 {
90 return false
91 }
92
93 return isContextType(methodType.In(1)) &&
94 isSubscriptionType(methodType.Out(0)) &&
95 isErrorType(methodType.Out(1))
96}
97
98// formatName will convert to first character to lower case
99func formatName(name string) string {

Callers 1

suitableCallbacksFunction · 0.85

Calls 3

isContextTypeFunction · 0.85
isSubscriptionTypeFunction · 0.85
isErrorTypeFunction · 0.85

Tested by

no test coverage detected