model/modelpb/labels_vtproto.pb.go (477 lines of code) (raw):

// Licensed to Elasticsearch B.V. under one or more contributor // license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright // ownership. Elasticsearch B.V. licenses this file to you under // the Apache License, Version 2.0 (the "License"); you may // not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // Code generated by protoc-gen-go-vtproto. DO NOT EDIT. // protoc-gen-go-vtproto version: v0.6.1-0.20240319094008-0393e58bdf10 // source: labels.proto package modelpb import ( binary "encoding/binary" fmt "fmt" io "io" math "math" protohelpers "github.com/planetscale/vtprotobuf/protohelpers" proto "google.golang.org/protobuf/proto" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) func (m *LabelValue) CloneVT() *LabelValue { if m == nil { return (*LabelValue)(nil) } r := new(LabelValue) r.Value = m.Value r.Global = m.Global if rhs := m.Values; rhs != nil { tmpContainer := make([]string, len(rhs)) copy(tmpContainer, rhs) r.Values = tmpContainer } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) } return r } func (m *LabelValue) CloneMessageVT() proto.Message { return m.CloneVT() } func (m *NumericLabelValue) CloneVT() *NumericLabelValue { if m == nil { return (*NumericLabelValue)(nil) } r := new(NumericLabelValue) r.Value = m.Value r.Global = m.Global if rhs := m.Values; rhs != nil { tmpContainer := make([]float64, len(rhs)) copy(tmpContainer, rhs) r.Values = tmpContainer } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) } return r } func (m *NumericLabelValue) CloneMessageVT() proto.Message { return m.CloneVT() } func (m *LabelValue) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } size := m.SizeVT() dAtA = make([]byte, size) n, err := m.MarshalToSizedBufferVT(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *LabelValue) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } func (m *LabelValue) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } i := len(dAtA) _ = i var l int _ = l if m.unknownFields != nil { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } if m.Global { i-- if m.Global { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x18 } if len(m.Values) > 0 { for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Values[iNdEx]) copy(dAtA[i:], m.Values[iNdEx]) i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Values[iNdEx]))) i-- dAtA[i] = 0x12 } } if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Value))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *NumericLabelValue) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } size := m.SizeVT() dAtA = make([]byte, size) n, err := m.MarshalToSizedBufferVT(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *NumericLabelValue) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } func (m *NumericLabelValue) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } i := len(dAtA) _ = i var l int _ = l if m.unknownFields != nil { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } if m.Global { i-- if m.Global { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x18 } if m.Value != 0 { i -= 8 binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.Value)))) i-- dAtA[i] = 0x11 } if len(m.Values) > 0 { for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { f1 := math.Float64bits(float64(m.Values[iNdEx])) i -= 8 binary.LittleEndian.PutUint64(dAtA[i:], uint64(f1)) } i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Values)*8)) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *LabelValue) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Value) if l > 0 { n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } if len(m.Values) > 0 { for _, s := range m.Values { l = len(s) n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } } if m.Global { n += 2 } n += len(m.unknownFields) return n } func (m *NumericLabelValue) SizeVT() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Values) > 0 { n += 1 + protohelpers.SizeOfVarint(uint64(len(m.Values)*8)) + len(m.Values)*8 } if m.Value != 0 { n += 9 } if m.Global { n += 2 } n += len(m.unknownFields) return n } func (m *LabelValue) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: LabelValue: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: LabelValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return protohelpers.ErrInvalidLength } postIndex := iNdEx + intStringLen if postIndex < 0 { return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Global", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Global = bool(v != 0) default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *NumericLabelValue) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NumericLabelValue: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NumericLabelValue: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType == 1 { var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 v2 := float64(math.Float64frombits(v)) m.Values = append(m.Values, v2) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ packedLen |= int(b&0x7F) << shift if b < 0x80 { break } } if packedLen < 0 { return protohelpers.ErrInvalidLength } postIndex := iNdEx + packedLen if postIndex < 0 { return protohelpers.ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } var elementCount int elementCount = packedLen / 8 if elementCount != 0 && len(m.Values) == 0 { m.Values = make([]float64, 0, elementCount) } for iNdEx < postIndex { var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 v2 := float64(math.Float64frombits(v)) m.Values = append(m.Values, v2) } } else { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } case 2: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } v = uint64(binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 m.Value = float64(math.Float64frombits(v)) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Global", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protohelpers.ErrIntOverflow } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Global = bool(v != 0) default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return protohelpers.ErrInvalidLength } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil }