[统计]记录流量(以5分钟作为间隔)

This commit is contained in:
GoEdgeLab
2020-12-11 17:28:20 +08:00
parent 806cd069b5
commit d2f72d7e87
9 changed files with 135 additions and 44 deletions

View File

@@ -0,0 +1,39 @@
package models
import (
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
_ "github.com/go-sql-driver/mysql"
"testing"
)
func TestServerDailyStatDAO_SaveStats(t *testing.T) {
stats := []*pb.ServerDailyStat{
{
ServerId: 1,
RegionId: 2,
Bytes: 1,
CreatedAt: 1607671488,
},
}
err := NewServerDailyStatDAO().SaveStats(stats)
if err != nil {
t.Fatal(err)
}
t.Log("ok")
}
func TestServerDailyStatDAO_SaveStats2(t *testing.T) {
stats := []*pb.ServerDailyStat{
{
ServerId: 1,
RegionId: 3,
Bytes: 1,
CreatedAt: 1607671488,
},
}
err := NewServerDailyStatDAO().SaveStats(stats)
if err != nil {
t.Fatal(err)
}
t.Log("ok")
}