GetTokensWithContext is the proxy function for the method defined in the tars file, with the context
(tarsCtx context.Context, request *TokenRequest, opts ...map[string]string)
| 177 | |
| 178 | // GetTokensWithContext is the proxy function for the method defined in the tars file, with the context |
| 179 | func (obj *Auth) GetTokensWithContext(tarsCtx context.Context, request *TokenRequest, opts ...map[string]string) (ret []TokenResponse, err error) { |
| 180 | var ( |
| 181 | length int32 |
| 182 | have bool |
| 183 | ty byte |
| 184 | ) |
| 185 | buf := codec.NewBuffer() |
| 186 | err = request.WriteBlock(buf, 1) |
| 187 | if err != nil { |
| 188 | return ret, err |
| 189 | } |
| 190 | |
| 191 | var statusMap map[string]string |
| 192 | var contextMap map[string]string |
| 193 | if len(opts) == 1 { |
| 194 | contextMap = opts[0] |
| 195 | } else if len(opts) == 2 { |
| 196 | contextMap = opts[0] |
| 197 | statusMap = opts[1] |
| 198 | } |
| 199 | |
| 200 | tarsResp := new(requestf.ResponsePacket) |
| 201 | err = obj.servant.TarsInvoke(tarsCtx, 0, "getTokens", buf.ToBytes(), statusMap, contextMap, tarsResp) |
| 202 | if err != nil { |
| 203 | return ret, err |
| 204 | } |
| 205 | readBuf := codec.NewReader(tools.Int8ToByte(tarsResp.SBuffer)) |
| 206 | _, ty, err = readBuf.SkipToNoCheck(0, true) |
| 207 | if err != nil { |
| 208 | return ret, err |
| 209 | } |
| 210 | if ty == codec.LIST { |
| 211 | err = readBuf.ReadInt32(&length, 0, true) |
| 212 | if err != nil { |
| 213 | return ret, err |
| 214 | } |
| 215 | ret = make([]TokenResponse, length) |
| 216 | for i0, e0 := int32(0), length; i0 < e0; i0++ { |
| 217 | err = ret[i0].ReadBlock(readBuf, 0, true) |
| 218 | if err != nil { |
| 219 | return ret, err |
| 220 | } |
| 221 | } |
| 222 | } else if ty == codec.SimpleList { |
| 223 | err = fmt.Errorf("not support SimpleList type") |
| 224 | if err != nil { |
| 225 | return ret, err |
| 226 | } |
| 227 | } else { |
| 228 | err = fmt.Errorf("require vector, but not") |
| 229 | if err != nil { |
| 230 | return ret, err |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | if len(opts) == 1 { |
| 235 | for k := range contextMap { |
| 236 | delete(contextMap, k) |
no test coverage detected