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 September 14, 2024 : doc: add kitex v0.11.0 release log (#1135) (796ca7c)