github.com/cloudwan/edgelq-sdk@v1.15.4/devices/resources/v1/device_distribution_counter/device_distribution_counter.pb.object_ext.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/devices/proto/v1/device_distribution_counter.proto
     3  // DO NOT EDIT!!!
     4  
     5  package device_distribution_counter
     6  
     7  import (
     8  	"fmt"
     9  	"sort"
    10  
    11  	"google.golang.org/protobuf/proto"
    12  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    13  
    14  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    15  )
    16  
    17  // proto imports
    18  import (
    19  	project "github.com/cloudwan/edgelq-sdk/devices/resources/v1/project"
    20  	meta "github.com/cloudwan/goten-sdk/types/meta"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = new(fmt.Stringer)
    26  	_ = new(sort.Interface)
    27  
    28  	_ = new(proto.Message)
    29  	_ = googlefieldmaskpb.FieldMask{}
    30  
    31  	_ = new(gotenobject.FieldPath)
    32  )
    33  
    34  // make sure we're using proto imports
    35  var (
    36  	_ = &project.Project{}
    37  	_ = &meta.Meta{}
    38  )
    39  
    40  func (o *DeviceDistributionCounter) GotenObjectExt() {}
    41  
    42  func (o *DeviceDistributionCounter) MakeFullFieldMask() *DeviceDistributionCounter_FieldMask {
    43  	return FullDeviceDistributionCounter_FieldMask()
    44  }
    45  
    46  func (o *DeviceDistributionCounter) MakeRawFullFieldMask() gotenobject.FieldMask {
    47  	return FullDeviceDistributionCounter_FieldMask()
    48  }
    49  
    50  func (o *DeviceDistributionCounter) MakeDiffFieldMask(other *DeviceDistributionCounter) *DeviceDistributionCounter_FieldMask {
    51  	if o == nil && other == nil {
    52  		return &DeviceDistributionCounter_FieldMask{}
    53  	}
    54  	if o == nil || other == nil {
    55  		return FullDeviceDistributionCounter_FieldMask()
    56  	}
    57  
    58  	res := &DeviceDistributionCounter_FieldMask{}
    59  	if o.GetName().String() != other.GetName().String() {
    60  		res.Paths = append(res.Paths, &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorName})
    61  	}
    62  	{
    63  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    64  		if subMask.IsFull() {
    65  			res.Paths = append(res.Paths, &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorMetadata})
    66  		} else {
    67  			for _, subpath := range subMask.Paths {
    68  				res.Paths = append(res.Paths, &DeviceDistributionCounter_FieldSubPath{selector: DeviceDistributionCounter_FieldPathSelectorMetadata, subPath: subpath})
    69  			}
    70  		}
    71  	}
    72  	if o.GetTotalCount() != other.GetTotalCount() {
    73  		res.Paths = append(res.Paths, &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorTotalCount})
    74  	}
    75  	if o.GetOnlineCount() != other.GetOnlineCount() {
    76  		res.Paths = append(res.Paths, &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorOnlineCount})
    77  	}
    78  	return res
    79  }
    80  
    81  func (o *DeviceDistributionCounter) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
    82  	return o.MakeDiffFieldMask(other.(*DeviceDistributionCounter))
    83  }
    84  
    85  func (o *DeviceDistributionCounter) Clone() *DeviceDistributionCounter {
    86  	if o == nil {
    87  		return nil
    88  	}
    89  	result := &DeviceDistributionCounter{}
    90  	if o.Name == nil {
    91  		result.Name = nil
    92  	} else if data, err := o.Name.ProtoString(); err != nil {
    93  		panic(err)
    94  	} else {
    95  		result.Name = &Name{}
    96  		if err := result.Name.ParseProtoString(data); err != nil {
    97  			panic(err)
    98  		}
    99  	}
   100  	result.Metadata = o.Metadata.Clone()
   101  	result.TotalCount = o.TotalCount
   102  	result.OnlineCount = o.OnlineCount
   103  	return result
   104  }
   105  
   106  func (o *DeviceDistributionCounter) CloneRaw() gotenobject.GotenObjectExt {
   107  	return o.Clone()
   108  }
   109  
   110  func (o *DeviceDistributionCounter) Merge(source *DeviceDistributionCounter) {
   111  	if source.GetName() != nil {
   112  		if data, err := source.GetName().ProtoString(); err != nil {
   113  			panic(err)
   114  		} else {
   115  			o.Name = &Name{}
   116  			if err := o.Name.ParseProtoString(data); err != nil {
   117  				panic(err)
   118  			}
   119  		}
   120  	} else {
   121  		o.Name = nil
   122  	}
   123  	if source.GetMetadata() != nil {
   124  		if o.Metadata == nil {
   125  			o.Metadata = new(meta.Meta)
   126  		}
   127  		o.Metadata.Merge(source.GetMetadata())
   128  	}
   129  	o.TotalCount = source.GetTotalCount()
   130  	o.OnlineCount = source.GetOnlineCount()
   131  }
   132  
   133  func (o *DeviceDistributionCounter) MergeRaw(source gotenobject.GotenObjectExt) {
   134  	o.Merge(source.(*DeviceDistributionCounter))
   135  }