Documentation
¶
Index ¶
- Variables
- func CalcRFM(args *ArgsCalcRFM) (err error)
- func ClearByCode(code string) (err error)
- func GetRFMByCodeAndYMAndExtend(args *ArgsGetRFMByCodeAndYMAndExtend) (result float64)
- func GetRFMExtendDistinctList(extendNum int) (dataList []string, err error)
- func Init() (err error)
- type ArgsCalcRFM
- type ArgsGetRFMByCodeAndBetweenAt
- type ArgsGetRFMByCodeAndYMAndExtend
- type ArgsGetRFMByCodeExtend
- type DataGetRFMByCodeAndBetweenAt
- type DataGetRFMByCodeAndBetweenAtResult
- type DataGetRFMByCodeExtend
- type FieldsRFM
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //OpenSub 是否启动订阅 OpenSub = false )
Functions ¶
func CalcRFM ¶
func CalcRFM(args *ArgsCalcRFM) (err error)
CalcRFM 计算RFM值并记录 注意RFM计算中,R指标需根据需求提前反转(也可以不反转),否则计算结果将出现异常
func GetRFMByCodeAndYMAndExtend ¶
func GetRFMByCodeAndYMAndExtend(args *ArgsGetRFMByCodeAndYMAndExtend) (result float64)
GetRFMByCodeAndYMAndExtend 获取指定编码和日期的RFM数据
func GetRFMExtendDistinctList ¶
GetRFMExtendDistinctList 获取指定维度的所有可选值
Types ¶
type ArgsCalcRFM ¶
type ArgsCalcRFM struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//年月
YearM string `db:"year_m" json:"yearM" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 维度和IndexVals模块一致
///////////////////////////////////////////////////////////////////////////////////////////////////
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算过程值
///////////////////////////////////////////////////////////////////////////////////////////////////
//R
RVal float64 `db:"r_val" json:"rVal"`
//RMin
RMin float64 `db:"r_min" json:"rMin"`
//RMax
RMax float64 `db:"r_max" json:"rMax"`
//R 权重
RWeight float64 `db:"r_weight" json:"rWeight"`
//F
FVal float64 `db:"f_val" json:"fVal"`
//FMin
FMin float64 `db:"f_min" json:"fMin"`
//FMax
FMax float64 `db:"f_max" json:"fMax"`
//F 权重
FWeight float64 `db:"f_weight" json:"fWeight"`
//M
MVal float64 `db:"m_val" json:"mVal"`
//MMin
MMin float64 `db:"m_min" json:"mMin"`
//MMax
MMax float64 `db:"m_max" json:"mMax"`
//M 权重
MWeight float64 `db:"m_weight" json:"mWeight"`
}
ArgsCalcRFM 计算RFM值并记录
type ArgsGetRFMByCodeAndBetweenAt ¶
type ArgsGetRFMByCodeAndBetweenAt struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true"`
//时间范围
StartAt string `json:"startAt"`
EndAt string `json:"endAt"`
}
ArgsGetRFMByCodeAndBetweenAt 获取指定时间范围的数据参数
type ArgsGetRFMByCodeAndYMAndExtend ¶
type ArgsGetRFMByCodeAndYMAndExtend struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//年月
YearM string `db:"year_m" json:"yearM" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 维度和IndexVals模块一致
///////////////////////////////////////////////////////////////////////////////////////////////////
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
}
ArgsGetRFMByCodeAndYMAndExtend 获取指定编码和日期的RFM数据参数
type ArgsGetRFMByCodeExtend ¶
type ArgsGetRFMByCodeExtend struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true"`
}
ArgsGetRFMByCodeExtend 不依赖时间的RFM参数
type DataGetRFMByCodeAndBetweenAt ¶
type DataGetRFMByCodeAndBetweenAt struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//年月
YearM string `db:"year_m" json:"yearM" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 维度和IndexVals模块一致
///////////////////////////////////////////////////////////////////////////////////////////////////
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算过程值
///////////////////////////////////////////////////////////////////////////////////////////////////
//R
RVal float64 `db:"r_val" json:"rVal"`
//RMin
RMin float64 `db:"r_min" json:"rMin"`
//RMax
RMax float64 `db:"r_max" json:"rMax"`
//R 权重
RWeight float64 `db:"r_weight" json:"rWeight"`
//F
FVal float64 `db:"f_val" json:"fVal"`
//FMin
FMin float64 `db:"f_min" json:"fMin"`
//FMax
FMax float64 `db:"f_max" json:"fMax"`
//F 权重
FWeight float64 `db:"f_weight" json:"fWeight"`
//M
MVal float64 `db:"m_val" json:"mVal"`
//MMin
MMin float64 `db:"m_min" json:"mMin"`
//MMax
MMax float64 `db:"m_max" json:"mMax"`
//M 权重
MWeight float64 `db:"m_weight" json:"mWeight"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算结果
///////////////////////////////////////////////////////////////////////////////////////////////////
RFMResult float64 `db:"rfm_result" json:"rfmResult"`
}
func GetRFMByCodeAndBetweenAt ¶
func GetRFMByCodeAndBetweenAt(args *ArgsGetRFMByCodeAndBetweenAt) (dataList []DataGetRFMByCodeAndBetweenAt)
GetRFMByCodeAndBetweenAt 获取指定时间范围的数据
func GetRFMByCodeAndBetweenAtResult ¶
func GetRFMByCodeAndBetweenAtResult(args *ArgsGetRFMByCodeAndBetweenAt) (dataList []DataGetRFMByCodeAndBetweenAt)
GetRFMByCodeAndBetweenAtResult 获取指定时间范围的数据结果 仅反馈结果
type DataGetRFMByCodeAndBetweenAtResult ¶
type DataGetRFMByCodeAndBetweenAtResult struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//年月
YearM string `db:"year_m" json:"yearM" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 维度和IndexVals模块一致
///////////////////////////////////////////////////////////////////////////////////////////////////
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算结果
///////////////////////////////////////////////////////////////////////////////////////////////////
RFMResult float64 `db:"rfm_result" json:"rfmResult"`
}
type DataGetRFMByCodeExtend ¶
type DataGetRFMByCodeExtend struct {
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 维度和IndexVals模块一致
///////////////////////////////////////////////////////////////////////////////////////////////////
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算过程值
///////////////////////////////////////////////////////////////////////////////////////////////////
//R
RVal float64 `db:"r_val" json:"rVal"`
//RMin
RMin float64 `db:"r_min" json:"rMin"`
//RMax
RMax float64 `db:"r_max" json:"rMax"`
//R 权重
RWeight float64 `db:"r_weight" json:"rWeight"`
//F
FVal float64 `db:"f_val" json:"fVal"`
//FMin
FMin float64 `db:"f_min" json:"fMin"`
//FMax
FMax float64 `db:"f_max" json:"fMax"`
//F 权重
FWeight float64 `db:"f_weight" json:"fWeight"`
//M
MVal float64 `db:"m_val" json:"mVal"`
//MMin
MMin float64 `db:"m_min" json:"mMin"`
//MMax
MMax float64 `db:"m_max" json:"mMax"`
//M 权重
MWeight float64 `db:"m_weight" json:"mWeight"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算结果
///////////////////////////////////////////////////////////////////////////////////////////////////
RFMResult float64 `db:"rfm_result" json:"rfmResult"`
}
func GetRFMByCodeExtend ¶
func GetRFMByCodeExtend(args *ArgsGetRFMByCodeExtend) (dataList []DataGetRFMByCodeExtend)
GetRFMByCodeExtend 不依赖时间的RFM 适用于RFM为全局不涵盖时间的数据
func GetRFMByCodeExtendOR ¶
func GetRFMByCodeExtendOR(args *ArgsGetRFMByCodeExtend) (dataList []DataGetRFMByCodeExtend)
GetRFMByCodeExtendOR 不依赖时间的RFM,且条件为或 适用于RFM为全局不涵盖时间,且维度关系可选的方式
func GetRFMByCodeExtendORNot ¶
func GetRFMByCodeExtendORNot(code string, extendInt int) (dataList []DataGetRFMByCodeExtend)
GetRFMByCodeExtendORNot 不依赖时间的RFM,且条件为非 适用于RFM为全局不涵盖时间,且维度关系可选的方式
type FieldsRFM ¶
type FieldsRFM struct {
// ID
ID int64 `db:"id" json:"id" check:"id" unique:"true"`
//创建时间
CreateAt time.Time `db:"create_at" json:"createAt" default:"now()"`
//更新时间
UpdateAt time.Time `db:"update_at" json:"updateAt" default:"now()"`
//删除时间
DeleteAt time.Time `db:"delete_at" json:"deleteAt" default:"0" index:"true"`
//指标编码
Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_list:"true"`
//年月
YearM string `db:"year_m" json:"yearM" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 维度和IndexVals模块一致
///////////////////////////////////////////////////////////////////////////////////////////////////
//扩展维度1
// 可建议特别的维度关系,例如特定供应商的数据、特定地区的数据等
Extend1 string `db:"extend1" json:"extend1" index:"true" field_list:"true"`
//扩展维度2
Extend2 string `db:"extend2" json:"extend2" index:"true" field_list:"true"`
//扩展维度3
Extend3 string `db:"extend3" json:"extend3" index:"true" field_list:"true"`
//扩展维度4
Extend4 string `db:"extend4" json:"extend4" index:"true" field_list:"true"`
//扩展维度5
Extend5 string `db:"extend5" json:"extend5" index:"true" field_list:"true"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算过程值
///////////////////////////////////////////////////////////////////////////////////////////////////
//R
RVal float64 `db:"r_val" json:"rVal"`
//RMin
RMin float64 `db:"r_min" json:"rMin"`
//RMax
RMax float64 `db:"r_max" json:"rMax"`
//R 权重
RWeight float64 `db:"r_weight" json:"rWeight"`
//F
FVal float64 `db:"f_val" json:"fVal"`
//FMin
FMin float64 `db:"f_min" json:"fMin"`
//FMax
FMax float64 `db:"f_max" json:"fMax"`
//F 权重
FWeight float64 `db:"f_weight" json:"fWeight"`
//M
MVal float64 `db:"m_val" json:"mVal"`
//MMin
MMin float64 `db:"m_min" json:"mMin"`
//MMax
MMax float64 `db:"m_max" json:"mMax"`
//M 权重
MWeight float64 `db:"m_weight" json:"mWeight"`
///////////////////////////////////////////////////////////////////////////////////////////////////
// 计算结果
///////////////////////////////////////////////////////////////////////////////////////////////////
RFMResult float64 `db:"rfm_result" json:"rfmResult"`
}
Click to show internal directories.
Click to hide internal directories.