Fallback

The cwgo tool supports fallback function, which can be either Kitex or Hz.

Fallback to Kitex

cwgo fallback kitex [global options] command [command options] [arguments...]

Example

  • Create hello.thrift
// hello.thrift
namespace go hello.example

struct HelloReq {
    1: string Name
}

struct HelloResp {
    1: string RespBody;
}

service HelloService {
    HelloResp HelloMethod(1: HelloReq request);
}
  • Execute Command
cwgo fallback kitex -module {your_module_name} hello.thrift

Kitex specific command reference document

Fallback to Hz

cwgo fallback hz [global options] command [command options] [arguments...]

Example

  • Create hello.thrift
// hello.thrift
namespace go hello.example

struct HelloReq {
    1: string Name (api.query="name");
}

struct HelloResp {
    1: string RespBody;
}


service HelloService {
    HelloResp HelloMethod(1: HelloReq request) (api.get="/hello1");
}(
     api.base_domain="http://127.0.0.1:8888";
 )
  • Execute Command
cwgo fallback hz new -module {your_module_name} -idl hello.thrift

Hz specific command reference document


Last modified October 17, 2024 : Fix multiple typos in shumei.md (#1159) (d3919b5)