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

Method DeleteTokenWithContext

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

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

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

Source from the content-addressed store, hash-verified

400
401// DeleteTokenWithContext is the proxy function for the method defined in the tars file, with the context
402func (obj *Auth) DeleteTokenWithContext(tarsCtx context.Context, request *DeleteTokenRequest, opts ...map[string]string) (ret int32, err error) {
403 var (
404 length int32
405 have bool
406 ty byte
407 )
408 buf := codec.NewBuffer()
409 err = request.WriteBlock(buf, 1)
410 if err != nil {
411 return ret, err
412 }
413
414 var statusMap map[string]string
415 var contextMap map[string]string
416 if len(opts) == 1 {
417 contextMap = opts[0]
418 } else if len(opts) == 2 {
419 contextMap = opts[0]
420 statusMap = opts[1]
421 }
422
423 tarsResp := new(requestf.ResponsePacket)
424 err = obj.servant.TarsInvoke(tarsCtx, 0, "deleteToken", buf.ToBytes(), statusMap, contextMap, tarsResp)
425 if err != nil {
426 return ret, err
427 }
428 readBuf := codec.NewReader(tools.Int8ToByte(tarsResp.SBuffer))
429 err = readBuf.ReadInt32(&ret, 0, true)
430 if err != nil {
431 return ret, err
432 }
433
434 if len(opts) == 1 {
435 for k := range contextMap {
436 delete(contextMap, k)
437 }
438 for k, v := range tarsResp.Context {
439 contextMap[k] = v
440 }
441 } else if len(opts) == 2 {
442 for k := range contextMap {
443 delete(contextMap, k)
444 }
445 for k, v := range tarsResp.Context {
446 contextMap[k] = v
447 }
448 for k := range statusMap {
449 delete(statusMap, k)
450 }
451 for k, v := range tarsResp.Status {
452 statusMap[k] = v
453 }
454 }
455
456 _ = length
457 _ = have
458 _ = ty
459 return ret, nil

Callers 1

DeleteTokenMethod · 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