MCPcopy
hub / github.com/TarsCloud/TarsGo / AuthProcessWithContext

Method AuthProcessWithContext

tars/protocol/res/authf/Auth.tars.go:79–137  ·  view source on GitHub ↗

AuthProcessWithContext is the proxy function for the method defined in the tars file, with the context

(tarsCtx context.Context, request *AuthRequest, opts ...map[string]string)

Source from the content-addressed store, hash-verified

77
78// AuthProcessWithContext is the proxy function for the method defined in the tars file, with the context
79func (obj *Auth) AuthProcessWithContext(tarsCtx context.Context, request *AuthRequest, opts ...map[string]string) (ret int32, err error) {
80 var (
81 length int32
82 have bool
83 ty byte
84 )
85 buf := codec.NewBuffer()
86 err = request.WriteBlock(buf, 1)
87 if err != nil {
88 return ret, err
89 }
90
91 var statusMap map[string]string
92 var contextMap map[string]string
93 if len(opts) == 1 {
94 contextMap = opts[0]
95 } else if len(opts) == 2 {
96 contextMap = opts[0]
97 statusMap = opts[1]
98 }
99
100 tarsResp := new(requestf.ResponsePacket)
101 err = obj.servant.TarsInvoke(tarsCtx, 0, "authProcess", buf.ToBytes(), statusMap, contextMap, tarsResp)
102 if err != nil {
103 return ret, err
104 }
105 readBuf := codec.NewReader(tools.Int8ToByte(tarsResp.SBuffer))
106 err = readBuf.ReadInt32(&ret, 0, true)
107 if err != nil {
108 return ret, err
109 }
110
111 if len(opts) == 1 {
112 for k := range contextMap {
113 delete(contextMap, k)
114 }
115 for k, v := range tarsResp.Context {
116 contextMap[k] = v
117 }
118 } else if len(opts) == 2 {
119 for k := range contextMap {
120 delete(contextMap, k)
121 }
122 for k, v := range tarsResp.Context {
123 contextMap[k] = v
124 }
125 for k := range statusMap {
126 delete(statusMap, k)
127 }
128 for k, v := range tarsResp.Status {
129 statusMap[k] = v
130 }
131 }
132
133 _ = length
134 _ = have
135 _ = ty
136 return ret, nil

Callers 1

AuthProcessMethod · 0.95

Calls 7

ToBytesMethod · 0.95
ReadInt32Method · 0.95
NewBufferFunction · 0.92
NewReaderFunction · 0.92
Int8ToByteFunction · 0.92
WriteBlockMethod · 0.65
TarsInvokeMethod · 0.65

Tested by

no test coverage detected