50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
// Code generated by Kitex v0.9.1. DO NOT EDIT.
|
|
|
|
package frontendservice
|
|
|
|
import (
|
|
"context"
|
|
client "github.com/cloudwego/kitex/client"
|
|
callopt "github.com/cloudwego/kitex/client/callopt"
|
|
facade "github.com/suyiiyii/hertz101/rpc_gen/kitex_gen/facade"
|
|
)
|
|
|
|
// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
|
|
type Client interface {
|
|
Login(ctx context.Context, Req *facade.LoginReq, callOptions ...callopt.Option) (r *facade.LoginResp, err error)
|
|
}
|
|
|
|
// NewClient creates a client for the service defined in IDL.
|
|
func NewClient(destService string, opts ...client.Option) (Client, error) {
|
|
var options []client.Option
|
|
options = append(options, client.WithDestService(destService))
|
|
|
|
options = append(options, opts...)
|
|
|
|
kc, err := client.NewClient(serviceInfo(), options...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &kFrontendServiceClient{
|
|
kClient: newServiceClient(kc),
|
|
}, nil
|
|
}
|
|
|
|
// MustNewClient creates a client for the service defined in IDL. It panics if any error occurs.
|
|
func MustNewClient(destService string, opts ...client.Option) Client {
|
|
kc, err := NewClient(destService, opts...)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return kc
|
|
}
|
|
|
|
type kFrontendServiceClient struct {
|
|
*kClient
|
|
}
|
|
|
|
func (p *kFrontendServiceClient) Login(ctx context.Context, Req *facade.LoginReq, callOptions ...callopt.Option) (r *facade.LoginResp, err error) {
|
|
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
|
|
return p.kClient.Login(ctx, Req)
|
|
}
|