Documentation
¶
Index ¶
- func AppendData(action, mark string, createAt time.Time, ...)
- func GetBetween(args *ArgsGetBetween) (data int64)
- func GetBetweenP(args *ArgsGetBetweenP) (prevData int64, lastData int64, addCount int64, p int64)
- func GetCitySNByName(name string) int64
- func GetLast(args *ArgsGetLast) (data int64)
- func GetSortNum(args *ArgsGetSortNum) (id int64)
- func Run()
- func SUMBetween(args *ArgsSUMBetween) (data int64)
- func SUMBetweenP(args *ArgsSUMBetweenP) (prevData int64, lastData int64, addCount int64, p int64)
- func SetConfigBefore(mark string, particle int, fileDay int) (err error)
- func SetConfigBeforeNoErr(mark string, particle int, fileDay int)
- func SetConfigFile(mark string, fileDay int) (err error)
- func SetConfigParticle(mark string, particle int) (err error)
- type ArgsGetBetween
- type ArgsGetBetweenArea
- type ArgsGetBetweenAreaMonth
- type ArgsGetBetweenP
- type ArgsGetCity
- type ArgsGetLast
- type ArgsGetSort
- type ArgsGetSortNum
- type ArgsSUMBetween
- type ArgsSUMBetweenArea
- type ArgsSUMBetweenAreaMonth
- type ArgsSUMBetweenP
- type DataGetBetweenArea
- type DataGetBetweenAreaMonth
- type DataGetCity
- type DataGetSort
- type DataGetSortP
- type DataGetSortPData
- type DataSUMBetweenArea
- type DataSUMBetweenAreaMonth
- type FieldsAny
- type FieldsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendData ¶
func AppendData(action, mark string, createAt time.Time, orgID, userID, bindID, param1, param2 int64, data int64)
AppendData 添加统计数据 只保留相同参数的最新值 action 支持:re 替代数据;add 叠加数据; reduce 减少
func GetBetweenP ¶
func GetBetweenP(args *ArgsGetBetweenP) (prevData int64, lastData int64, addCount int64, p int64)
GetBetweenP 获取两组时间数据并对比
func GetCitySNByName ¶
GetCitySNByName 通过城市名称获取编码 可用于添加数据时,bindID的指定
func SUMBetweenP ¶
func SUMBetweenP(args *ArgsSUMBetweenP) (prevData int64, lastData int64, addCount int64, p int64)
SUMBetweenP 获取两组时间合计数并对比
func SetConfigBefore ¶
SetConfigBefore 预先构建数据集 particle 颗粒度参考: 0 小时(默认)/ 1 1天 / 2 1周 / 3 1月 / 4 1年
func SetConfigBeforeNoErr ¶
SetConfigBeforeNoErr 预先构建数据集 particle 颗粒度参考: 0 小时(默认)/ 1 1天 / 2 1周 / 3 1月 / 4 1年
func SetConfigFile ¶
SetConfigFile 设置配置归档天数
func SetConfigParticle ¶
SetConfigParticle 设置配置颗粒度
Types ¶
type ArgsGetBetween ¶
type ArgsGetBetween struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
}
ArgsGetBetween 获取指定时间范围的数据参数
type ArgsGetBetweenArea ¶
type ArgsGetBetweenArea struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
//均化数量限制
// 将数据以平均值形式散开投放到集合内
// 此限制为切割长度
Limit int64 `json:"limit"`
}
ArgsGetBetweenArea 获取指定时间范围的数据集参数
type ArgsGetBetweenAreaMonth ¶
type ArgsGetBetweenAreaMonth struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
}
ArgsGetBetweenAreaMonth 获取指定范围的月份数据参数
type ArgsGetBetweenP ¶
type ArgsGetBetweenP struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAtPrev time.Time `json:"minAtPrev"`
MaxAtPrev time.Time `json:"maxAtPrev"`
MinAtLast time.Time `json:"minAtLast"`
MaxAtLast time.Time `json:"maxAtLast"`
}
ArgsGetBetweenP 获取两组时间数据并对比参数
type ArgsGetCity ¶
type ArgsGetLast ¶
type ArgsGetLast struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
}
ArgsGetLast 获取指定最新的数据参数
type ArgsGetSort ¶
type ArgsGetSort struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
//是否倒叙
Desc bool `json:"desc"`
//均化数量限制
// 将数据以平均值形式散开投放到集合内
// 此限制为切割长度
Limit int `json:"limit"`
}
type ArgsGetSortNum ¶
type ArgsGetSortNum struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
}
ArgsGetSortNum 获取指定参数在排名的第几位参数
type ArgsSUMBetween ¶
type ArgsSUMBetween struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
}
ArgsSUMBetween 获取指定时间范围的合计数参数
type ArgsSUMBetweenArea ¶
type ArgsSUMBetweenArea struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
//均化数量限制
// 将数据以平均值形式散开投放到集合内
// 此限制为切割长度
Limit int64 `json:"limit"`
}
ArgsSUMBetweenArea 获取指定时间范围的数据集参数
type ArgsSUMBetweenAreaMonth ¶
type ArgsSUMBetweenAreaMonth struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAt time.Time `json:"minAt"`
MaxAt time.Time `json:"maxAt"`
}
ArgsSUMBetweenAreaMonth 获取指定范围的月份数据参数
type ArgsSUMBetweenP ¶
type ArgsSUMBetweenP struct {
//标识码
Mark string `json:"mark" check:"mark"`
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//时间范围
MinAtPrev time.Time `json:"minAtPrev"`
MaxAtPrev time.Time `json:"maxAtPrev"`
MinAtLast time.Time `json:"minAtLast"`
MaxAtLast time.Time `json:"maxAtLast"`
}
ArgsSUMBetweenP 获取两组时间合计数并对比参数
type DataGetBetweenArea ¶
type DataGetBetweenArea struct {
//数据时间
CreateAt time.Time `json:"createAt"`
//数据
Data int64 `json:"data"`
}
func GetBetweenArea ¶
func GetBetweenArea(args *ArgsGetBetweenArea) (dataList []DataGetBetweenArea)
GetBetweenArea 获取指定时间范围的数据集 按照指定颗粒数量分拆均化后展示
type DataGetBetweenAreaMonth ¶
type DataGetBetweenAreaMonth struct {
//年月
Date string `json:"date"`
//数据
Data int64 `json:"data"`
}
DataGetBetweenAreaMonth 获取指定范围的月份数据集合
func GetBetweenAreaMonth ¶
func GetBetweenAreaMonth(args *ArgsGetBetweenAreaMonth) (dataList []DataGetBetweenAreaMonth)
GetBetweenAreaMonth 获取指定范围的月份数据
type DataGetCity ¶
func GetCity ¶
func GetCity(args *ArgsGetCity) (dataList []DataGetCity)
type DataGetSort ¶
type DataGetSort struct {
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//数据
Data int64 `db:"data" json:"data"`
}
func GetSort ¶
func GetSort(args *ArgsGetSort) (dataList []DataGetSort)
type DataGetSortP ¶
type DataGetSortP struct {
//总额度
AllDataCount int64 `json:"allDataCount"`
//数据集合
DataList []DataGetSortPData
}
DataGetSortP 获取排名数据的占比排列数据
func GetSortP ¶
func GetSortP(args *ArgsGetSort) (data DataGetSortP)
GetSortP 获取排名数据的占比排列 将排名全部相加后,计算每个排名对象的占比
type DataGetSortPData ¶
type DataGetSortPData struct {
//组织ID
// 可留空
OrgID int64 `json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Params1 int64 `json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Params2 int64 `json:"params2" check:"id" empty:"true"`
//数据
Data int64 `db:"data" json:"data"`
//占比
// 35.12% = 3512
DataP int64 `json:"dataP"`
}
type DataSUMBetweenArea ¶
type DataSUMBetweenArea struct {
//数据时间
CreateAt time.Time `json:"createAt"`
//数据
Data int64 `json:"data"`
}
func SUMBetweenArea ¶
func SUMBetweenArea(args *ArgsSUMBetweenArea) (dataList []DataSUMBetweenArea)
SUMBetweenArea 获取指定时间范围的数据集 按照指定颗粒数量分拆均化后展示
type DataSUMBetweenAreaMonth ¶
type DataSUMBetweenAreaMonth struct {
//年月
Date string `json:"date"`
//数据
Data int64 `json:"data"`
}
DataSUMBetweenAreaMonth 获取指定范围的月份数据集合
func SUMBetweenAreaMonth ¶
func SUMBetweenAreaMonth(args *ArgsSUMBetweenAreaMonth) (dataList []DataSUMBetweenAreaMonth)
SUMBetweenAreaMonth 获取指定范围的月份数据
type FieldsAny ¶
type FieldsAny struct {
//ID
ID int64 `db:"id" json:"id" check:"id"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt"`
//组织ID
// 可留空
OrgID int64 `db:"org_id" json:"orgID" check:"id" empty:"true"`
//用户ID
// 可留空
UserID int64 `db:"user_id" json:"userID" check:"id" empty:"true"`
//绑定ID
BindID int64 `db:"bind_id" json:"bindID" check:"id" empty:"true"`
//扩展参数1
// 可选扩展参数,默认给0无视
Param1 int64 `db:"params1" json:"params1" check:"id" empty:"true"`
//扩展参数2
// 可选扩展参数,默认给0无视
Param2 int64 `db:"params2" json:"params2" check:"id" empty:"true"`
//数据配置ID
ConfigID int64 `db:"config_id" json:"configID" check:"id"`
//数据
Data int64 `db:"data" json:"data"`
}
FieldsAny 统计数据支持
type FieldsConfig ¶
type FieldsConfig struct {
//ID
ID int64 `db:"id" json:"id" check:"id"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt"`
//数据标识码
Mark string `db:"mark" json:"mark" check:"mark"`
//颗粒度
// 0 小时(默认)/ 1 1天 / 2 1周 / 3 1月 / 4 1年
Particle int `db:"particle" json:"particle"`
//归档天数
// 自动生成的数据为30天
// 必须指定,小于1则强制按照3天计算
FileDay int `db:"file_day" json:"fileDay" check:"intThan0"`
}
FieldsConfig 统计配置