th7/db/dummy.go

27 lines
526 B
Go
Raw Normal View History

2022-11-12 14:20:29 +00:00
package db
import (
"fmt"
"th7/data/core"
2022-11-12 14:20:29 +00:00
)
type DummyAdapter struct {
}
2022-11-12 16:22:55 +00:00
func NewDummyAdapter() (*DummyAdapter, error) {
2022-11-12 14:20:29 +00:00
return &DummyAdapter{}, nil
}
func (d *DummyAdapter) Close() {
fmt.Println("Closing DB ...")
}
func (d *DummyAdapter) Save(channels []core.Channel) error {
fmt.Println("=======================================")
for _, val := range channels {
fmt.Printf("Saved: id=%d, unit=%d, value=%g\n", val.Id, val.Unit, val.Value)
}
fmt.Println("=======================================")
return nil
2022-11-12 14:20:29 +00:00
}