package models // collection of drivers ordered in map type Drivers map[string]*Driver // driver model type Driver struct { 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, Address: address, } }