removing error not required
This commit is contained in:
parent
8b116f51a6
commit
8036c9840b
@ -52,11 +52,11 @@ func (t *TH7Adapter) GetChannel(id int) (core.Channel, error) {
|
||||
return core.Channel{}, errors.New("specified channel not configured")
|
||||
}
|
||||
|
||||
func (t *TH7Adapter) GetChannels() ([]core.Channel, error) {
|
||||
func (t *TH7Adapter) GetChannels() []core.Channel {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
|
||||
return t.data, nil
|
||||
return t.data
|
||||
}
|
||||
|
||||
func (t *TH7Adapter) GetVref() float64 {
|
||||
|
@ -11,14 +11,11 @@ func startLoggingProcess(db ports.DBPort, core ports.CorePort, dur time.Duration
|
||||
// wait 10 seconds to not log start up values that can be noisy
|
||||
time.Sleep(10 * time.Second)
|
||||
|
||||
for true {
|
||||
for {
|
||||
|
||||
val, err := core.GetChannels()
|
||||
if err != nil {
|
||||
fmt.Printf("Error encountered while getting values: %v\n", err)
|
||||
}
|
||||
val := core.GetChannels()
|
||||
|
||||
err = db.Save(val)
|
||||
err := db.Save(val)
|
||||
if err != nil {
|
||||
fmt.Printf("Error encountered while saving values: %v\n", err)
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ func NewSQLite3Adapter(dbInfo map[string]interface{}) (*SQLite3Adapter, error) {
|
||||
|
||||
func (ad *SQLite3Adapter) Close() {
|
||||
ad.db.Close()
|
||||
return
|
||||
}
|
||||
|
||||
func (ad *SQLite3Adapter) Save([]core.Channel) error {
|
||||
|
@ -4,7 +4,7 @@ import "th7/data/core"
|
||||
|
||||
type CorePort interface {
|
||||
GetChannel(int) (core.Channel, error)
|
||||
GetChannels() ([]core.Channel, error)
|
||||
GetChannels() []core.Channel
|
||||
GetVref() float64
|
||||
GetVadj() float64
|
||||
GetPivdd() float64
|
||||
|
@ -17,15 +17,8 @@ type GinAdapter struct {
|
||||
func (g GinAdapter) registerEndpoints() {
|
||||
|
||||
g.router.GET("/channels", func(c *gin.Context) {
|
||||
channels, err := g.corePort.GetChannels()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"error": err,
|
||||
})
|
||||
} else {
|
||||
channels := g.corePort.GetChannels()
|
||||
c.JSON(http.StatusOK, channels)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
g.router.GET("/channel/:id", func(c *gin.Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user