Skip to content

Commit

Permalink
refactor!: update data types in ResourceProperties
Browse files Browse the repository at this point in the history
BREAKING CHANGE: support mask,shift,base,scale,offset in numeric data type

related to edgexfoundry/go-mod-core-contracts#770

Signed-off-by: Chris Hung <chris@iotechsys.com>
  • Loading branch information
Chris Hung committed Mar 14, 2023
1 parent 2dcc4a6 commit c3c5272
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 221 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/OneOfOne/xxhash v1.2.8
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.44
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.26
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.28
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.16
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.44 h1:bzROMV3XZzFB5uBFTeQ
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.44/go.mod h1:qiG4HABtB+mnFBOby/ZUpIWcQD0TZa8jIG7p/jeVuzc=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.7 h1:pOH2GLDg1KB4EmAzo6IEvl4NEVFAw3ywxPUMa5Wi1Vw=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.7/go.mod h1:ZZbOu7K0/P8B1VKhZygVujLQyhvWuPe0E2vC/k2yscw=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.26 h1:vTTaaM3NErQRoNQKkbQ9f9x/FMJqzZX6OAQuXvU6HN8=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.26/go.mod h1:QBzXOAoyLzBm5k9CshgH9CR9nWMNXxZjknBFMnGJN/A=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.28 h1:aNHlmF2uPcwUr7VKvNVJXdxMDaI41j2laoGxZy5H95g=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.28/go.mod h1:SYoD+tmUP/zwWuuIySmsQSjPx6MHP+2w9FsLgm0IR7A=
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.16 h1:JdZiqZ6CAboZ3+GuWZLyXc42y8HfsH1CmsIKNPY+0PY=
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.16/go.mod h1:3q+Ys51HwpR9/kOv6sT7+EwAANgOfFWi509sEP5iPEo=
github.com/edgexfoundry/go-mod-registry/v3 v3.0.0-dev.5 h1:FUUfsQUKHJqSwOXEj0j/qAn+uoWzM8nV7IOapGf7D80=
Expand Down
8 changes: 4 additions & 4 deletions internal/transformer/transformparam.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- Mode: Go; indent-tabs-mode: t -*-
//
// Copyright (C) 2018-2021 IOTech Ltd
// Copyright (C) 2018-2023 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -39,19 +39,19 @@ func TransformWriteParameter(cv *dsModels.CommandValue, pv models.ResourceProper
return errors.NewCommonEdgeXWrapper(err)
}
}
if pv.Offset != "" && pv.Offset != defaultOffset {
if pv.Offset != 0 && pv.Offset != defaultOffset {
newValue, err = transformOffset(newValue, pv.Offset, false)
if err != nil {
return errors.NewCommonEdgeXWrapper(err)
}
}
if pv.Scale != "" && pv.Scale != defaultScale {
if pv.Scale != 0 && pv.Scale != defaultScale {
newValue, err = transformScale(newValue, pv.Scale, false)
if err != nil {
return errors.NewCommonEdgeXWrapper(err)
}
}
if pv.Base != "" && pv.Base != defaultBase {
if pv.Base != 0 && pv.Base != defaultBase {
newValue, err = transformBase(newValue, pv.Base, false)
if err != nil {
return errors.NewCommonEdgeXWrapper(err)
Expand Down
Loading

0 comments on commit c3c5272

Please sign in to comment.