You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
390 lines
9.6 KiB
390 lines
9.6 KiB
// Code generated by Kitex v0.3.4. DO NOT EDIT.
|
|
|
|
package commentservice
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/TremblingV5/DouTok/kitex_gen/comment"
|
|
"github.com/cloudwego/kitex/client"
|
|
kitex "github.com/cloudwego/kitex/pkg/serviceinfo"
|
|
"github.com/cloudwego/kitex/pkg/streaming"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
func serviceInfo() *kitex.ServiceInfo {
|
|
return commentServiceServiceInfo
|
|
}
|
|
|
|
var commentServiceServiceInfo = NewServiceInfo()
|
|
|
|
func NewServiceInfo() *kitex.ServiceInfo {
|
|
serviceName := "CommentService"
|
|
handlerType := (*comment.CommentService)(nil)
|
|
methods := map[string]kitex.MethodInfo{
|
|
"CommentAction": kitex.NewMethodInfo(commentActionHandler, newCommentActionArgs, newCommentActionResult, false),
|
|
"CommentList": kitex.NewMethodInfo(commentListHandler, newCommentListArgs, newCommentListResult, false),
|
|
"CommentCount": kitex.NewMethodInfo(commentCountHandler, newCommentCountArgs, newCommentCountResult, false),
|
|
}
|
|
extra := map[string]interface{}{
|
|
"PackageName": "comment",
|
|
}
|
|
svcInfo := &kitex.ServiceInfo{
|
|
ServiceName: serviceName,
|
|
HandlerType: handlerType,
|
|
Methods: methods,
|
|
PayloadCodec: kitex.Protobuf,
|
|
KiteXGenVersion: "v0.3.4",
|
|
Extra: extra,
|
|
}
|
|
return svcInfo
|
|
}
|
|
|
|
func commentActionHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
|
|
switch s := arg.(type) {
|
|
case *streaming.Args:
|
|
st := s.Stream
|
|
req := new(comment.DouyinCommentActionRequest)
|
|
if err := st.RecvMsg(req); err != nil {
|
|
return err
|
|
}
|
|
resp, err := handler.(comment.CommentService).CommentAction(ctx, req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := st.SendMsg(resp); err != nil {
|
|
return err
|
|
}
|
|
case *CommentActionArgs:
|
|
success, err := handler.(comment.CommentService).CommentAction(ctx, s.Req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
realResult := result.(*CommentActionResult)
|
|
realResult.Success = success
|
|
}
|
|
return nil
|
|
}
|
|
func newCommentActionArgs() interface{} {
|
|
return &CommentActionArgs{}
|
|
}
|
|
|
|
func newCommentActionResult() interface{} {
|
|
return &CommentActionResult{}
|
|
}
|
|
|
|
type CommentActionArgs struct {
|
|
Req *comment.DouyinCommentActionRequest
|
|
}
|
|
|
|
func (p *CommentActionArgs) Marshal(out []byte) ([]byte, error) {
|
|
if !p.IsSetReq() {
|
|
return out, fmt.Errorf("No req in CommentActionArgs")
|
|
}
|
|
return proto.Marshal(p.Req)
|
|
}
|
|
|
|
func (p *CommentActionArgs) Unmarshal(in []byte) error {
|
|
msg := new(comment.DouyinCommentActionRequest)
|
|
if err := proto.Unmarshal(in, msg); err != nil {
|
|
return err
|
|
}
|
|
p.Req = msg
|
|
return nil
|
|
}
|
|
|
|
var CommentActionArgs_Req_DEFAULT *comment.DouyinCommentActionRequest
|
|
|
|
func (p *CommentActionArgs) GetReq() *comment.DouyinCommentActionRequest {
|
|
if !p.IsSetReq() {
|
|
return CommentActionArgs_Req_DEFAULT
|
|
}
|
|
return p.Req
|
|
}
|
|
|
|
func (p *CommentActionArgs) IsSetReq() bool {
|
|
return p.Req != nil
|
|
}
|
|
|
|
type CommentActionResult struct {
|
|
Success *comment.DouyinCommentActionResponse
|
|
}
|
|
|
|
var CommentActionResult_Success_DEFAULT *comment.DouyinCommentActionResponse
|
|
|
|
func (p *CommentActionResult) Marshal(out []byte) ([]byte, error) {
|
|
if !p.IsSetSuccess() {
|
|
return out, fmt.Errorf("No req in CommentActionResult")
|
|
}
|
|
return proto.Marshal(p.Success)
|
|
}
|
|
|
|
func (p *CommentActionResult) Unmarshal(in []byte) error {
|
|
msg := new(comment.DouyinCommentActionResponse)
|
|
if err := proto.Unmarshal(in, msg); err != nil {
|
|
return err
|
|
}
|
|
p.Success = msg
|
|
return nil
|
|
}
|
|
|
|
func (p *CommentActionResult) GetSuccess() *comment.DouyinCommentActionResponse {
|
|
if !p.IsSetSuccess() {
|
|
return CommentActionResult_Success_DEFAULT
|
|
}
|
|
return p.Success
|
|
}
|
|
|
|
func (p *CommentActionResult) SetSuccess(x interface{}) {
|
|
p.Success = x.(*comment.DouyinCommentActionResponse)
|
|
}
|
|
|
|
func (p *CommentActionResult) IsSetSuccess() bool {
|
|
return p.Success != nil
|
|
}
|
|
|
|
func commentListHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
|
|
switch s := arg.(type) {
|
|
case *streaming.Args:
|
|
st := s.Stream
|
|
req := new(comment.DouyinCommentListRequest)
|
|
if err := st.RecvMsg(req); err != nil {
|
|
return err
|
|
}
|
|
resp, err := handler.(comment.CommentService).CommentList(ctx, req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := st.SendMsg(resp); err != nil {
|
|
return err
|
|
}
|
|
case *CommentListArgs:
|
|
success, err := handler.(comment.CommentService).CommentList(ctx, s.Req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
realResult := result.(*CommentListResult)
|
|
realResult.Success = success
|
|
}
|
|
return nil
|
|
}
|
|
func newCommentListArgs() interface{} {
|
|
return &CommentListArgs{}
|
|
}
|
|
|
|
func newCommentListResult() interface{} {
|
|
return &CommentListResult{}
|
|
}
|
|
|
|
type CommentListArgs struct {
|
|
Req *comment.DouyinCommentListRequest
|
|
}
|
|
|
|
func (p *CommentListArgs) Marshal(out []byte) ([]byte, error) {
|
|
if !p.IsSetReq() {
|
|
return out, fmt.Errorf("No req in CommentListArgs")
|
|
}
|
|
return proto.Marshal(p.Req)
|
|
}
|
|
|
|
func (p *CommentListArgs) Unmarshal(in []byte) error {
|
|
msg := new(comment.DouyinCommentListRequest)
|
|
if err := proto.Unmarshal(in, msg); err != nil {
|
|
return err
|
|
}
|
|
p.Req = msg
|
|
return nil
|
|
}
|
|
|
|
var CommentListArgs_Req_DEFAULT *comment.DouyinCommentListRequest
|
|
|
|
func (p *CommentListArgs) GetReq() *comment.DouyinCommentListRequest {
|
|
if !p.IsSetReq() {
|
|
return CommentListArgs_Req_DEFAULT
|
|
}
|
|
return p.Req
|
|
}
|
|
|
|
func (p *CommentListArgs) IsSetReq() bool {
|
|
return p.Req != nil
|
|
}
|
|
|
|
type CommentListResult struct {
|
|
Success *comment.DouyinCommentListResponse
|
|
}
|
|
|
|
var CommentListResult_Success_DEFAULT *comment.DouyinCommentListResponse
|
|
|
|
func (p *CommentListResult) Marshal(out []byte) ([]byte, error) {
|
|
if !p.IsSetSuccess() {
|
|
return out, fmt.Errorf("No req in CommentListResult")
|
|
}
|
|
return proto.Marshal(p.Success)
|
|
}
|
|
|
|
func (p *CommentListResult) Unmarshal(in []byte) error {
|
|
msg := new(comment.DouyinCommentListResponse)
|
|
if err := proto.Unmarshal(in, msg); err != nil {
|
|
return err
|
|
}
|
|
p.Success = msg
|
|
return nil
|
|
}
|
|
|
|
func (p *CommentListResult) GetSuccess() *comment.DouyinCommentListResponse {
|
|
if !p.IsSetSuccess() {
|
|
return CommentListResult_Success_DEFAULT
|
|
}
|
|
return p.Success
|
|
}
|
|
|
|
func (p *CommentListResult) SetSuccess(x interface{}) {
|
|
p.Success = x.(*comment.DouyinCommentListResponse)
|
|
}
|
|
|
|
func (p *CommentListResult) IsSetSuccess() bool {
|
|
return p.Success != nil
|
|
}
|
|
|
|
func commentCountHandler(ctx context.Context, handler interface{}, arg, result interface{}) error {
|
|
switch s := arg.(type) {
|
|
case *streaming.Args:
|
|
st := s.Stream
|
|
req := new(comment.DouyinCommentCountRequest)
|
|
if err := st.RecvMsg(req); err != nil {
|
|
return err
|
|
}
|
|
resp, err := handler.(comment.CommentService).CommentCount(ctx, req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := st.SendMsg(resp); err != nil {
|
|
return err
|
|
}
|
|
case *CommentCountArgs:
|
|
success, err := handler.(comment.CommentService).CommentCount(ctx, s.Req)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
realResult := result.(*CommentCountResult)
|
|
realResult.Success = success
|
|
}
|
|
return nil
|
|
}
|
|
func newCommentCountArgs() interface{} {
|
|
return &CommentCountArgs{}
|
|
}
|
|
|
|
func newCommentCountResult() interface{} {
|
|
return &CommentCountResult{}
|
|
}
|
|
|
|
type CommentCountArgs struct {
|
|
Req *comment.DouyinCommentCountRequest
|
|
}
|
|
|
|
func (p *CommentCountArgs) Marshal(out []byte) ([]byte, error) {
|
|
if !p.IsSetReq() {
|
|
return out, fmt.Errorf("No req in CommentCountArgs")
|
|
}
|
|
return proto.Marshal(p.Req)
|
|
}
|
|
|
|
func (p *CommentCountArgs) Unmarshal(in []byte) error {
|
|
msg := new(comment.DouyinCommentCountRequest)
|
|
if err := proto.Unmarshal(in, msg); err != nil {
|
|
return err
|
|
}
|
|
p.Req = msg
|
|
return nil
|
|
}
|
|
|
|
var CommentCountArgs_Req_DEFAULT *comment.DouyinCommentCountRequest
|
|
|
|
func (p *CommentCountArgs) GetReq() *comment.DouyinCommentCountRequest {
|
|
if !p.IsSetReq() {
|
|
return CommentCountArgs_Req_DEFAULT
|
|
}
|
|
return p.Req
|
|
}
|
|
|
|
func (p *CommentCountArgs) IsSetReq() bool {
|
|
return p.Req != nil
|
|
}
|
|
|
|
type CommentCountResult struct {
|
|
Success *comment.DouyinCommentCountResponse
|
|
}
|
|
|
|
var CommentCountResult_Success_DEFAULT *comment.DouyinCommentCountResponse
|
|
|
|
func (p *CommentCountResult) Marshal(out []byte) ([]byte, error) {
|
|
if !p.IsSetSuccess() {
|
|
return out, fmt.Errorf("No req in CommentCountResult")
|
|
}
|
|
return proto.Marshal(p.Success)
|
|
}
|
|
|
|
func (p *CommentCountResult) Unmarshal(in []byte) error {
|
|
msg := new(comment.DouyinCommentCountResponse)
|
|
if err := proto.Unmarshal(in, msg); err != nil {
|
|
return err
|
|
}
|
|
p.Success = msg
|
|
return nil
|
|
}
|
|
|
|
func (p *CommentCountResult) GetSuccess() *comment.DouyinCommentCountResponse {
|
|
if !p.IsSetSuccess() {
|
|
return CommentCountResult_Success_DEFAULT
|
|
}
|
|
return p.Success
|
|
}
|
|
|
|
func (p *CommentCountResult) SetSuccess(x interface{}) {
|
|
p.Success = x.(*comment.DouyinCommentCountResponse)
|
|
}
|
|
|
|
func (p *CommentCountResult) IsSetSuccess() bool {
|
|
return p.Success != nil
|
|
}
|
|
|
|
type kClient struct {
|
|
c client.Client
|
|
}
|
|
|
|
func newServiceClient(c client.Client) *kClient {
|
|
return &kClient{
|
|
c: c,
|
|
}
|
|
}
|
|
|
|
func (p *kClient) CommentAction(ctx context.Context, Req *comment.DouyinCommentActionRequest) (r *comment.DouyinCommentActionResponse, err error) {
|
|
var _args CommentActionArgs
|
|
_args.Req = Req
|
|
var _result CommentActionResult
|
|
if err = p.c.Call(ctx, "CommentAction", &_args, &_result); err != nil {
|
|
return
|
|
}
|
|
return _result.GetSuccess(), nil
|
|
}
|
|
|
|
func (p *kClient) CommentList(ctx context.Context, Req *comment.DouyinCommentListRequest) (r *comment.DouyinCommentListResponse, err error) {
|
|
var _args CommentListArgs
|
|
_args.Req = Req
|
|
var _result CommentListResult
|
|
if err = p.c.Call(ctx, "CommentList", &_args, &_result); err != nil {
|
|
return
|
|
}
|
|
return _result.GetSuccess(), nil
|
|
}
|
|
|
|
func (p *kClient) CommentCount(ctx context.Context, Req *comment.DouyinCommentCountRequest) (r *comment.DouyinCommentCountResponse, err error) {
|
|
var _args CommentCountArgs
|
|
_args.Req = Req
|
|
var _result CommentCountResult
|
|
if err = p.c.Call(ctx, "CommentCount", &_args, &_result); err != nil {
|
|
return
|
|
}
|
|
return _result.GetSuccess(), nil
|
|
}
|
|
|