MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / serverReturnFunc

Method serverReturnFunc

cli/pkg/common/websocket.go:116–130  ·  view source on GitHub ↗

** * Description: 查询结构体中的方法 * author: kenanlu@leansoftx.com * create on: 2021-04-17 11:47:12 * return: ControllerMapsType */

()

Source from the content-addressed store, hash-verified

114 * return: ControllerMapsType
115 */
116func (w *receiver) serverReturnFunc() ControllerMapsType {
117 var m ClientMethod
118 vf := reflect.ValueOf(&m)
119 vft := vf.Type()
120 //读取方法数量
121 mNum := vf.NumMethod()
122 crMap := make(ControllerMapsType, 0)
123
124 //遍历所有的方法,并将其存入映射变量中
125 for i := 0; i < mNum; i++ {
126 mName := vft.Method(i).Name
127 crMap[mName] = vf.Method(i)
128 }
129 return crMap
130}
131func (w *receiver) pushMap(k int, c chan []byte) int {
132 w.receiverMtx.Lock()
133 if _, ok := w.receiver[k]; ok {

Callers 1

ClientCodeToFuncMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected