AnalysisAny2

package
v5.1.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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 GetBetween

func GetBetween(args *ArgsGetBetween) (data int64)

GetBetween 获取指定时间范围的数据

func GetBetweenP

func GetBetweenP(args *ArgsGetBetweenP) (prevData int64, lastData int64, addCount int64, p int64)

GetBetweenP 获取两组时间数据并对比

func GetCitySNByName

func GetCitySNByName(name string) int64

GetCitySNByName 通过城市名称获取编码 可用于添加数据时,bindID的指定

func GetLast

func GetLast(args *ArgsGetLast) (data int64)

GetLast 获取指定时间最新的数据

func GetSortNum

func GetSortNum(args *ArgsGetSortNum) (id int64)

GetSortNum 获取指定参数在排名的第几位

func Run

func Run()

func SUMBetween

func SUMBetween(args *ArgsSUMBetween) (data int64)

SUMBetween 获取指定时间范围的合计数

func SUMBetweenP

func SUMBetweenP(args *ArgsSUMBetweenP) (prevData int64, lastData int64, addCount int64, p int64)

SUMBetweenP 获取两组时间合计数并对比

func SetConfigBefore

func SetConfigBefore(mark string, particle int, fileDay int) (err error)

SetConfigBefore 预先构建数据集 particle 颗粒度参考: 0 小时(默认)/ 1 1天 / 2 1周 / 3 1月 / 4 1年

func SetConfigBeforeNoErr

func SetConfigBeforeNoErr(mark string, particle int, fileDay int)

SetConfigBeforeNoErr 预先构建数据集 particle 颗粒度参考: 0 小时(默认)/ 1 1天 / 2 1周 / 3 1月 / 4 1年

func SetConfigFile

func SetConfigFile(mark string, fileDay int) (err error)

SetConfigFile 设置配置归档天数

func SetConfigParticle

func SetConfigParticle(mark string, particle int) (err error)

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 ArgsGetCity struct {
	//标识码
	Mark string `json:"mark" check:"mark"`
	//组织ID
	// 可留空
	OrgID int64 `json:"orgID" check:"id" empty:"true"`
	//模式
	// 0 城市模式
	Mode int `json:"mode"`
	//时间范围
	MinAt time.Time `json:"minAt"`
	MaxAt time.Time `json:"maxAt"`
}

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

type DataGetCity struct {
	//城市名称
	CityName string `json:"cityName"`
	//数据
	Data int64 `json:"data"`
}

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 统计配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL