12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package data
- import "time"
- // EdbBridge 桥接数据源接口(算了别用了难用的一批, 不如直接判断商户号来的方便快捷...)
- type EdbBridge interface {
- GetIndex(GetIndexFromBridgeReq) (BridgeIndexItem, error)
- //GetIndexAndData(GetIndexAndDataFromBridgeReq) (BridgeIndexItem, error)
- }
- // GetIndexFromBridgeReq 获取指标信息请求体
- type GetIndexFromBridgeReq struct {
- IndexCode string `description:"指标编码"`
- Source int `description:"指标来源ID"`
- SourceExtend string `description:"指标来源(用作查询条件)"`
- IndexCodeRequired int `description:"指标编码是否必填: 0-否; 1-是"`
- }
- // GetIndexAndDataFromBridgeReq 获取指标数据请求体
- type GetIndexAndDataFromBridgeReq struct {
- IndexCode string `description:"指标编码"`
- Source int `description:"指标来源ID"`
- SourceExtend string `description:"指标来源(用作查询条件)"`
- StartDate string `description:"数据开始日期"`
- EndDate string `description:"数据结束日期"`
- }
- // BridgeIndexItem 桥接服务指标信息
- type BridgeIndexItem struct {
- Id int `description:"自增ID"`
- IndexCode string `description:"指标编码"`
- IndexName string `description:"指标名称"`
- Unit string `description:"单位"`
- Frequency string `description:"频度"`
- Data []BridgeIndexDataItem `description:"数据值"`
- }
- // BridgeIndexDataItem 桥接服务指标数据信息
- type BridgeIndexDataItem struct {
- Val float64 `description:"数据值"`
- DataTime time.Time `description:"数据日期"`
- UpdateTime time.Time `description:"更新时间"`
- }
- // InitBridgeOB 初始化桥接服务
- func InitBridgeOB(bridgeKey string) EdbBridge {
- switch bridgeKey {
- case "bridge_jiayue":
- return new(EdbBridgeJiaYue) // 嘉悦物产
- }
- return nil
- }
|