First off, thank you for the hard work you put into this library – it works very very well in my KNX-HomeKit bridge project (releasing as open source as well soon).
In that project I needed a way to create and store concrete values of datapoint types. The problem is that Produce only returns a DatapointValue so type assertions are necessary when trying to use Unit() (part of the DatapointMeta interface) or String() (from fmt.Stringer).
Would you consider this change of adding a combined interface and returning that from Produce()?
type Datapoint interface {
DatapointValue
DatapointMeta
fmt.Stringer
}
This change does not require any other changes besides the 3 I made in the type registry and the test suite is still green without any changes.
Thank you for considering it – in case you do accept the change I'd update the commit message description to explain the reasoning before the merge.
First off, thank you for the hard work you put into this library – it works very very well in my KNX-HomeKit bridge project (releasing as open source as well soon).
In that project I needed a way to create and store concrete values of datapoint types. The problem is that
Produce
only returns aDatapointValue
so type assertions are necessary when trying to useUnit()
(part of theDatapointMeta
interface) orString()
(fromfmt.Stringer
).Would you consider this change of adding a combined interface and returning that from
Produce()
?This change does not require any other changes besides the 3 I made in the type registry and the test suite is still green without any changes.
Thank you for considering it – in case you do accept the change I'd update the commit message description to explain the reasoning before the merge.