Dispatch is used to call the server side implement for the method defined in the tars file. withContext shows using context or not.
(tarsCtx context.Context, val interface{}, tarsReq *requestf.RequestPacket, tarsResp *requestf.ResponsePacket, withContext bool)
| 348 | |
| 349 | // Dispatch is used to call the server side implement for the method defined in the tars file. withContext shows using context or not. |
| 350 | func (obj *Log) Dispatch(tarsCtx context.Context, val interface{}, tarsReq *requestf.RequestPacket, tarsResp *requestf.ResponsePacket, withContext bool) (err error) { |
| 351 | var ( |
| 352 | length int32 |
| 353 | have bool |
| 354 | ty byte |
| 355 | ) |
| 356 | readBuf := codec.NewReader(tools.Int8ToByte(tarsReq.SBuffer)) |
| 357 | buf := codec.NewBuffer() |
| 358 | switch tarsReq.SFuncName { |
| 359 | case "logger": |
| 360 | var app string |
| 361 | var server string |
| 362 | var file string |
| 363 | var format string |
| 364 | var buffer []string |
| 365 | buffer = make([]string, 0) |
| 366 | if tarsReq.IVersion == basef.TARSVERSION { |
| 367 | err = readBuf.ReadString(&app, 1, true) |
| 368 | if err != nil { |
| 369 | return err |
| 370 | } |
| 371 | err = readBuf.ReadString(&server, 2, true) |
| 372 | if err != nil { |
| 373 | return err |
| 374 | } |
| 375 | err = readBuf.ReadString(&file, 3, true) |
| 376 | if err != nil { |
| 377 | return err |
| 378 | } |
| 379 | err = readBuf.ReadString(&format, 4, true) |
| 380 | if err != nil { |
| 381 | return err |
| 382 | } |
| 383 | _, ty, err = readBuf.SkipToNoCheck(5, true) |
| 384 | if err != nil { |
| 385 | return err |
| 386 | } |
| 387 | if ty == codec.LIST { |
| 388 | err = readBuf.ReadInt32(&length, 0, true) |
| 389 | if err != nil { |
| 390 | return err |
| 391 | } |
| 392 | buffer = make([]string, length) |
| 393 | for i0, e0 := int32(0), length; i0 < e0; i0++ { |
| 394 | err = readBuf.ReadString(&buffer[i0], 0, true) |
| 395 | if err != nil { |
| 396 | return err |
| 397 | } |
| 398 | } |
| 399 | } else if ty == codec.SimpleList { |
| 400 | err = fmt.Errorf("not support SimpleList type") |
| 401 | if err != nil { |
| 402 | return err |
| 403 | } |
| 404 | } else { |
| 405 | err = fmt.Errorf("require vector, but not") |
| 406 | if err != nil { |
| 407 | return err |
nothing calls this directly
no test coverage detected