github.com/cloudwego/kitex@v0.9.0/pkg/remote/trans/netpollmux/control_frame.go (about)

     1  /*
     2   * Copyright 2022 CloudWeGo Authors
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  // Code generated by thriftgo (0.1.7). DO NOT EDIT.
    18  
    19  // Source code:
    20  //
    21  //     struct ControlFrame {}
    22  
    23  package netpollmux
    24  
    25  import (
    26  	"fmt"
    27  
    28  	"github.com/apache/thrift/lib/go/thrift"
    29  )
    30  
    31  type ControlFrame struct{}
    32  
    33  func NewControlFrame() *ControlFrame {
    34  	return &ControlFrame{}
    35  }
    36  
    37  var fieldIDToName_ControlFrame = map[int16]string{}
    38  
    39  func (p *ControlFrame) Read(iprot thrift.TProtocol) (err error) {
    40  	var fieldTypeId thrift.TType
    41  	var fieldId int16
    42  
    43  	if _, err = iprot.ReadStructBegin(); err != nil {
    44  		goto ReadStructBeginError
    45  	}
    46  
    47  	for {
    48  		_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
    49  		if err != nil {
    50  			goto ReadFieldBeginError
    51  		}
    52  		if fieldTypeId == thrift.STOP {
    53  			break
    54  		}
    55  		if err = iprot.Skip(fieldTypeId); err != nil {
    56  			goto SkipFieldTypeError
    57  		}
    58  
    59  		if err = iprot.ReadFieldEnd(); err != nil {
    60  			goto ReadFieldEndError
    61  		}
    62  	}
    63  	if err = iprot.ReadStructEnd(); err != nil {
    64  		goto ReadStructEndError
    65  	}
    66  
    67  	return nil
    68  ReadStructBeginError:
    69  	return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
    70  ReadFieldBeginError:
    71  	return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
    72  SkipFieldTypeError:
    73  	return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err)
    74  
    75  ReadFieldEndError:
    76  	return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
    77  ReadStructEndError:
    78  	return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
    79  }
    80  
    81  func (p *ControlFrame) Write(oprot thrift.TProtocol) (err error) {
    82  	if err = oprot.WriteStructBegin("ControlFrame"); err != nil {
    83  		goto WriteStructBeginError
    84  	}
    85  	if p != nil {
    86  	}
    87  	if err = oprot.WriteFieldStop(); err != nil {
    88  		goto WriteFieldStopError
    89  	}
    90  	if err = oprot.WriteStructEnd(); err != nil {
    91  		goto WriteStructEndError
    92  	}
    93  	return nil
    94  WriteStructBeginError:
    95  	return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
    96  WriteFieldStopError:
    97  	return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
    98  WriteStructEndError:
    99  	return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
   100  }
   101  
   102  func (p *ControlFrame) String() string {
   103  	if p == nil {
   104  		return "<nil>"
   105  	}
   106  	return fmt.Sprintf("ControlFrame(%+v)", *p)
   107  }