-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add core-metadata device service related db methods for postgres
related #4909 Signed-off-by: Ginny Guan <ginny@iotechsys.com>
- Loading branch information
1 parent
39fb801
commit 76daa36
Showing
12 changed files
with
470 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- | ||
-- Copyright (C) 2024 IOTech Ltd | ||
-- | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
-- schema for core-metadata related tables | ||
CREATE SCHEMA IF NOT EXISTS core_metadata; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- | ||
-- Copyright (C) 2024 IOTech Ltd | ||
-- | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
-- core_data.event is used to store the device_service information | ||
CREATE TABLE IF NOT EXISTS core_metadata.device_service ( | ||
id UUID PRIMARY KEY, | ||
content JSONB NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// | ||
// Copyright (C) 2024 IOTech Ltd | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package postgres | ||
|
||
import ( | ||
"github.com/edgexfoundry/go-mod-core-contracts/v3/errors" | ||
model "github.com/edgexfoundry/go-mod-core-contracts/v3/models" | ||
) | ||
|
||
// Add a new device | ||
func (c *Client) AddDevice(d model.Device) (device model.Device, err errors.EdgeX) { | ||
return device, nil | ||
} | ||
|
||
// DeleteDeviceById deletes a device by id | ||
func (c *Client) DeleteDeviceById(id string) errors.EdgeX { | ||
return nil | ||
} | ||
|
||
// DeleteDeviceByName deletes a device by name | ||
func (c *Client) DeleteDeviceByName(name string) errors.EdgeX { | ||
return nil | ||
} | ||
|
||
// DevicesByServiceName query devices by offset, limit and name | ||
func (c *Client) DevicesByServiceName(offset int, limit int, name string) (ds []model.Device, err errors.EdgeX) { | ||
return ds, nil | ||
} | ||
|
||
// DeviceIdExists checks the device existence by id | ||
func (c *Client) DeviceIdExists(id string) (exist bool, err errors.EdgeX) { | ||
return exist, nil | ||
} | ||
|
||
// DeviceNameExists checks the device existence by name | ||
func (c *Client) DeviceNameExists(id string) (exist bool, err errors.EdgeX) { | ||
return exist, nil | ||
} | ||
|
||
// DeviceById gets a device by id | ||
func (c *Client) DeviceById(id string) (device model.Device, err errors.EdgeX) { | ||
return device, nil | ||
} | ||
|
||
// DeviceByName gets a device by name | ||
func (c *Client) DeviceByName(name string) (device model.Device, err errors.EdgeX) { | ||
return device, nil | ||
} | ||
|
||
// AllDevices query the devices with offset, limit, and labels | ||
func (c *Client) AllDevices(offset int, limit int, labels []string) (ds []model.Device, err errors.EdgeX) { | ||
return ds, nil | ||
} | ||
|
||
// DevicesByProfileName query devices by offset, limit and profile name | ||
func (c *Client) DevicesByProfileName(offset int, limit int, profileName string) (ds []model.Device, err errors.EdgeX) { | ||
return ds, nil | ||
} | ||
|
||
// Update a device | ||
func (c *Client) UpdateDevice(d model.Device) errors.EdgeX { | ||
return nil | ||
} | ||
|
||
// DeviceCountByLabels returns the total count of Devices with labels specified. If no label is specified, the total count of all devices will be returned. | ||
func (c *Client) DeviceCountByLabels(labels []string) (count uint32, err errors.EdgeX) { | ||
return count, nil | ||
} | ||
|
||
// DeviceCountByProfileName returns the count of Devices associated with specified profile | ||
func (c *Client) DeviceCountByProfileName(profileName string) (count uint32, err errors.EdgeX) { | ||
return count, nil | ||
} | ||
|
||
// DeviceCountByServiceName returns the count of Devices associated with specified service | ||
func (c *Client) DeviceCountByServiceName(serviceName string) (count uint32, err errors.EdgeX) { | ||
return count, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// | ||
// Copyright (C) 2024 IOTech Ltd | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package postgres | ||
|
||
import ( | ||
"github.com/edgexfoundry/go-mod-core-contracts/v3/errors" | ||
model "github.com/edgexfoundry/go-mod-core-contracts/v3/models" | ||
) | ||
|
||
// Add a new device profile | ||
func (c *Client) AddDeviceProfile(dp model.DeviceProfile) (deviceProfile model.DeviceProfile, err errors.EdgeX) { | ||
return deviceProfile, nil | ||
} | ||
|
||
// UpdateDeviceProfile updates a new device profile | ||
func (c *Client) UpdateDeviceProfile(dp model.DeviceProfile) errors.EdgeX { | ||
return nil | ||
} | ||
|
||
// DeviceProfileById gets a device profile by id | ||
func (c *Client) DeviceProfileById(id string) (deviceProfile model.DeviceProfile, err errors.EdgeX) { | ||
return deviceProfile, nil | ||
} | ||
|
||
// DeviceProfileByName gets a device profile by name | ||
func (c *Client) DeviceProfileByName(name string) (deviceProfile model.DeviceProfile, err errors.EdgeX) { | ||
return deviceProfile, nil | ||
} | ||
|
||
// DeleteDeviceProfileById deletes a device profile by id | ||
func (c *Client) DeleteDeviceProfileById(id string) errors.EdgeX { | ||
return nil | ||
} | ||
|
||
// DeleteDeviceProfileByName deletes a device profile by name | ||
func (c *Client) DeleteDeviceProfileByName(name string) errors.EdgeX { | ||
return nil | ||
} | ||
|
||
// DeviceProfileNameExists checks the device profile exists by name | ||
func (c *Client) DeviceProfileNameExists(name string) (exist bool, err errors.EdgeX) { | ||
return exist, nil | ||
} | ||
|
||
// AllDeviceProfiles query device profiles with offset and limit | ||
func (c *Client) AllDeviceProfiles(offset int, limit int, labels []string) (profiles []model.DeviceProfile, err errors.EdgeX) { | ||
return profiles, nil | ||
} | ||
|
||
// DeviceProfilesByModel query device profiles with offset, limit and model | ||
func (c *Client) DeviceProfilesByModel(offset int, limit int, model string) (profiles []model.DeviceProfile, err errors.EdgeX) { | ||
return profiles, nil | ||
} | ||
|
||
// DeviceProfilesByManufacturer query device profiles with offset, limit and manufacturer | ||
func (c *Client) DeviceProfilesByManufacturer(offset int, limit int, manufacturer string) (profiles []model.DeviceProfile, err errors.EdgeX) { | ||
return profiles, nil | ||
} | ||
|
||
// DeviceProfilesByManufacturerAndModel query device profiles with offset, limit, manufacturer and model | ||
func (c *Client) DeviceProfilesByManufacturerAndModel(offset int, limit int, manufacturer string, model string) (profiles []model.DeviceProfile, count uint32, err errors.EdgeX) { | ||
return profiles, count, nil | ||
} | ||
|
||
// DeviceProfileCountByLabels returns the total count of Device Profiles with labels specified. If no label is specified, the total count of all device profiles will be returned. | ||
func (c *Client) DeviceProfileCountByLabels(labels []string) (count uint32, err errors.EdgeX) { | ||
return count, nil | ||
} | ||
|
||
// DeviceProfileCountByManufacturer returns the count of Device Profiles associated with specified manufacturer | ||
func (c *Client) DeviceProfileCountByManufacturer(manufacturer string) (count uint32, err errors.EdgeX) { | ||
return count, nil | ||
} | ||
|
||
// DeviceProfileCountByModel returns the count of Device Profiles associated with specified model | ||
func (c *Client) DeviceProfileCountByModel(model string) (count uint32, err errors.EdgeX) { | ||
return count, nil | ||
} |
Oops, something went wrong.