add comments and new parameter id for client request order
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user