package common_models import ( "fmt" "time" ) type AggData struct { Date time.Time SensorId int StructId int FactorId int AggTypeId int // 聚集类型 : 10分钟/30分钟/3小时/6小时/12小时/时/日/周/月聚集 AggMethodId int // 聚集方法 : 平均值/最大值/最小值 Agg map[string]float64 // 聚集数据 Changed map[string]float64 // 变化量 ThingId string } func (the *AggData) T() time.Time { return the.Date } func (the *AggData) Q() string { return fmt.Sprintf("aggData:%d", the.SensorId) } func (the *AggData) R() string { return fmt.Sprintf("[Structure:%d][Station:%d]", the.StructId, the.SensorId) } func (the *AggData) GetThingId() string { return the.ThingId } // GetDeviceId 功能未实现的功能,会返回“”,只是未了实现接口 IDataTrace func (the *AggData) GetDeviceId() string { return "unknown" } var typeDict = map[int]string{ 2001: "d", 2002: "w", 2003: "m", 2004: "y", 2005: "h", 2006: "10m", 2007: "30m", 2008: "3h", 2009: "6h", 2010: "12h", 3001: "avg", 3002: "max", 3003: "min", 3004: "mid", 3005: "sum", } //func GetAggTypeName(t int) string { // if val, ok := typeDict[t]; ok { // return val // } // return "" //}