add comments and new parameter id for client request order

This commit is contained in:
Adrian Zuercher
2025-05-04 20:55:58 +02:00
parent c7154f0779
commit e3487eb340
15 changed files with 119 additions and 79 deletions

View File

@@ -2,27 +2,31 @@ package models
import "github.com/google/uuid"
// Set model
type Set struct {
Uuid uuid.UUID `json:"uuid,omitempty"`
Path string `json:"path"`
Driver *Driver `json:"driver,omitempty"`
Drivers *Drivers `json:"drivers,omitempty"`
Type Type `json:"type,omitempty"`
Value any `json:"value,omitempty"`
Rights Rights `json:"rights,omitempty"`
Uuid uuid.UUID `json:"uuid,omitempty"` // universally unique identifier
Path string `json:"path"` // dbm path
Driver *Driver `json:"driver,omitempty"` // assign new driver
Drivers *Drivers `json:"drivers,omitempty"` // assigned drivers
Type Type `json:"type,omitempty"` // dbm datatype
Value any `json:"value,omitempty"` // dbm value
Rights Rights `json:"rights,omitempty"` // dbm read /write rights
Updated bool `json:"-"`
}
// sets value and path
func (s *Set) ValueByPath(path string, value any) {
s.Path = path
s.Value = value
}
// sets value and uuid
func (s *Set) ValueByUuid(uid string, value any) {
s.Uuid = uuid.MustParse(uid)
s.Value = value
}
// sets new datapoint with given parameters
func (s *Set) New(path string, typ Type, value any, rights Rights) {
s.Path = path
s.Type = typ
@@ -30,6 +34,7 @@ func (s *Set) New(path string, typ Type, value any, rights Rights) {
s.Rights = rights.GetRights()
}
// sets new driver typ with bus and address
func (s *Set) NewDriver(typ, bus string, address uint) {
s.Driver = &Driver{
Type: typ,