Support none database type to disable stats/telemetry

Fixes #21
This commit is contained in:
Maddie Zhan
2021-09-18 01:48:10 +08:00
parent 7204ae2e19
commit 8c1aa6b39b
7 changed files with 55 additions and 5 deletions

23
database/none/none.go Normal file
View File

@ -0,0 +1,23 @@
package none
import (
"github.com/librespeed/speedtest/database/schema"
)
type None struct{}
func Open(_ string) *None {
return &None{}
}
func (n *None) Insert(_ *schema.TelemetryData) error {
return nil
}
func (n *None) FetchByUUID(_ string) (*schema.TelemetryData, error) {
return &schema.TelemetryData{}, nil
}
func (n *None) FetchLast100() ([]schema.TelemetryData, error) {
return []schema.TelemetryData{}, nil
}