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

@@ -1,17 +1,22 @@
package models
// collection of drivers ordered in map
type Drivers map[string]*Driver
// driver model
type Driver struct {
Type string `json:"type,omitempty"`
Bus string `json:"bus"`
Address uint `json:"address"`
Type string `json:"type,omitempty"` // driver type name of driver in collection
Bus string `json:"bus"` // name of driver bus
Address uint `json:"address"` // address of bus
}
// returns a new collection of drivers
func NewDrivers() Drivers {
return make(Drivers)
}
// Add new driver to driver collection
// typ is the name of the driver in driver collection
func (d *Drivers) AddDriver(typ, bus string, address uint) {
(*d)[typ] = &Driver{
Bus: bus,