IRequest interface: It actually packages the connection information and request data of the client request into Request (实际上是把客户端请求的连接信息 和 请求的数据 包装到了 Request里)
| 14 | // It actually packages the connection information and request data of the client request into Request |
| 15 | // (实际上是把客户端请求的连接信息 和 请求的数据 包装到了 Request里) |
| 16 | type IRequest interface { |
| 17 | GetConnection() IConnection // Get the connection information of the request(获取请求连接信息) |
| 18 | |
| 19 | GetData() []byte // Get the data of the request message(获取请求消息的数据) |
| 20 | GetMsgID() uint32 // Get the message ID of the request(获取请求的消息ID) |
| 21 | |
| 22 | GetMessage() IMessage // Get the raw data of the request message (获取请求消息的原始数据 add by uuxia 2023-03-10) |
| 23 | |
| 24 | GetResponse() IcResp // Get the serialized data after parsing(获取解析完后序列化数据) |
| 25 | SetResponse(IcResp) // Set the serialized data after parsing(设置解析完后序列化数据) |
| 26 | |
| 27 | BindRouter(router IRouter) // Bind which router handles this request(绑定这次请求由哪个路由处理) |
| 28 | // Move on to the next handler to start execution, but the function that calls this method will execute in reverse order of their order |
| 29 | // (转进到下一个处理器开始执行 但是调用此方法的函数会根据先后顺序逆序执行) |
| 30 | Call() |
| 31 | |
| 32 | //erminate the execution of the processing function, but the function that calls this method will be executed until completion |
| 33 | // 终止处理函数的运行 但调用此方法的函数会执行完毕 |
| 34 | Abort() |
| 35 | |
| 36 | //Specify which Handler function to execute next in the Handle |
| 37 | // (指定接下来的Handle去执行哪个Handler函数) |
| 38 | // Be careful, it will cause loop calling |
| 39 | // (慎用,会导致循环调用) |
| 40 | Goto(HandleStep) |
| 41 | |
| 42 | // New router operation |
| 43 | // (新路由操作) |
| 44 | BindRouterSlices([]RouterHandler) |
| 45 | |
| 46 | // Execute the next function |
| 47 | // (执行下一个函数) |
| 48 | RouterSlicesNext() |
| 49 | |
| 50 | // 重置一个 Request |
| 51 | //Reset(conn IConnection, msg IMessage) |
| 52 | // 复制一份 Request 对象 |
| 53 | Copy() IRequest |
| 54 | //Set 在 Request 中存放一个上下文 |
| 55 | Set(key string, value interface{}) |
| 56 | //Get 从 Request 中获取一个上下文信息 |
| 57 | Get(key string) (value interface{}, exists bool) |
| 58 | } |
| 59 | |
| 60 | type BaseRequest struct{} |
| 61 |
no outgoing calls
no test coverage detected