feat(platform): query tdengine history data
This commit is contained in:
@@ -2,6 +2,7 @@ package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -16,11 +17,20 @@ func NewServer(cfg config.Config) http.Handler {
|
||||
if cfg.MySQLDSN != "" {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
db, err := platform.OpenMySQL(ctx, cfg.MySQLDSN)
|
||||
db, err := platform.OpenSQL(ctx, "mysql", cfg.MySQLDSN)
|
||||
if err != nil {
|
||||
log.Printf("production mysql store disabled: %v", err)
|
||||
} else {
|
||||
store = platform.NewProductionStore(db, cfg.TDengineDatabase)
|
||||
var tdengine *sql.DB
|
||||
if cfg.TDengineDSN != "" {
|
||||
tdengine, err = platform.OpenSQL(ctx, cfg.TDengineDriver, cfg.TDengineDSN)
|
||||
if err != nil {
|
||||
log.Printf("production tdengine store disabled: %v", err)
|
||||
} else {
|
||||
log.Printf("production tdengine store enabled")
|
||||
}
|
||||
}
|
||||
store = platform.NewProductionStore(db, tdengine, cfg.TDengineDatabase)
|
||||
log.Printf("production mysql store enabled")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user