chore: simplify
This commit is contained in:
parent
2e15a47cee
commit
eb98e080a8
3 changed files with 9 additions and 15 deletions
|
|
@ -11,11 +11,9 @@ func init() {
|
|||
|
||||
func NewChargerFromTemplateConfig(other map[string]interface{}) (api.Charger, error) {
|
||||
instance, err := templates.RenderInstance(templates.Charger, other)
|
||||
|
||||
var res api.Charger
|
||||
if err == nil {
|
||||
res, err = NewFromConfig(instance.Type, instance.Other)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, err
|
||||
return NewFromConfig(instance.Type, instance.Other)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,9 @@ func init() {
|
|||
|
||||
func NewMeterFromTemplateConfig(other map[string]interface{}) (api.Meter, error) {
|
||||
instance, err := templates.RenderInstance(templates.Meter, other)
|
||||
|
||||
var res api.Meter
|
||||
if err == nil {
|
||||
res, err = NewFromConfig(instance.Type, instance.Other)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, err
|
||||
return NewFromConfig(instance.Type, instance.Other)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,9 @@ func init() {
|
|||
|
||||
func NewVehicleFromTemplateConfig(other map[string]interface{}) (api.Vehicle, error) {
|
||||
instance, err := templates.RenderInstance(templates.Vehicle, other)
|
||||
|
||||
var res api.Vehicle
|
||||
if err == nil {
|
||||
res, err = NewFromConfig(instance.Type, instance.Other)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, err
|
||||
return NewFromConfig(instance.Type, instance.Other)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue