add SaveMode for device which can be 0 (All) or a bitmask for what to save. It did not improve performance
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-09-26 10:50:54 +02:00
parent b1fa52e53f
commit 0cd325e8db
5 changed files with 71 additions and 52 deletions
+11 -3
View File
@@ -20,8 +20,8 @@ type Device struct {
}
type DeviceUpdate struct {
Icon *string `json:"icon"`
Name *string `json:"name"`
Icon *string `json:"icon"`
Name *string `json:"name"`
UserProperties map[string]*string `json:"userProperties"`
}
@@ -46,10 +46,18 @@ type NewDeviceState struct {
type DeviceCapability string
type SaveMode int
const (
SMState SaveMode = 1
SMProperties SaveMode = 2
SMTags SaveMode = 4
)
type DeviceRepository interface {
Find(ctx context.Context, id int) (*Device, error)
FetchByReference(ctx context.Context, kind ReferenceKind, value string) ([]Device, error)
Save(ctx context.Context, device *Device) error
Save(ctx context.Context, device *Device, mode SaveMode) error
Delete(ctx context.Context, device *Device) error
}