MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / SetFields

Method SetFields

pkg/ttnpb/end_device.pb.setters.fm.go:2966–3694  ·  view source on GitHub ↗
(src *EndDevice, paths ...string)

Source from the content-addressed store, hash-verified

2964}
2965
2966func (dst *EndDevice) SetFields(src *EndDevice, paths ...string) error {
2967 for name, subs := range _processPaths(paths) {
2968 switch name {
2969 case "ids":
2970 if len(subs) > 0 {
2971 var newDst, newSrc *EndDeviceIdentifiers
2972 if (src == nil || src.Ids == nil) && dst.Ids == nil {
2973 continue
2974 }
2975 if src != nil {
2976 newSrc = src.Ids
2977 }
2978 if dst.Ids != nil {
2979 newDst = dst.Ids
2980 } else {
2981 newDst = &EndDeviceIdentifiers{}
2982 dst.Ids = newDst
2983 }
2984 if err := newDst.SetFields(newSrc, subs...); err != nil {
2985 return err
2986 }
2987 } else {
2988 if src != nil {
2989 dst.Ids = src.Ids
2990 } else {
2991 dst.Ids = nil
2992 }
2993 }
2994 case "created_at":
2995 if len(subs) > 0 {
2996 return fmt.Errorf("'created_at' has no subfields, but %s were specified", subs)
2997 }
2998 if src != nil {
2999 dst.CreatedAt = src.CreatedAt
3000 } else {
3001 dst.CreatedAt = nil
3002 }
3003 case "updated_at":
3004 if len(subs) > 0 {
3005 return fmt.Errorf("'updated_at' has no subfields, but %s were specified", subs)
3006 }
3007 if src != nil {
3008 dst.UpdatedAt = src.UpdatedAt
3009 } else {
3010 dst.UpdatedAt = nil
3011 }
3012 case "name":
3013 if len(subs) > 0 {
3014 return fmt.Errorf("'name' has no subfields, but %s were specified", subs)
3015 }
3016 if src != nil {
3017 dst.Name = src.Name
3018 } else {
3019 var zero string
3020 dst.Name = zero
3021 }
3022 case "description":
3023 if len(subs) > 0 {

Callers 10

HandleJoinMethod · 0.95
SetMethod · 0.95
validateTemplateFunction · 0.95
SetFieldsMethod · 0.95
SetFieldsMethod · 0.95
SetFieldsMethod · 0.95
SetFieldsMethod · 0.95
endDeviceToPBFunction · 0.95
getEndDeviceFunction · 0.95
setEndDeviceFunction · 0.95

Calls 3

SetFieldsMethod · 0.95
_processPathsFunction · 0.85
ErrorfMethod · 0.65

Tested by 1

validateTemplateFunction · 0.76