edb_data.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. package data
  2. import (
  3. "errors"
  4. "eta_gn/eta_api/models"
  5. "eta_gn/eta_api/models/data_manage"
  6. "eta_gn/eta_api/models/mgo"
  7. "eta_gn/eta_api/utils"
  8. "fmt"
  9. "github.com/shopspring/decimal"
  10. "go.mongodb.org/mongo-driver/bson"
  11. "time"
  12. )
  13. type EdbDataEdit struct {
  14. OldCreateDate string `description:"旧的录入日期"`
  15. CreateDate string `description:"新的录入日期"`
  16. TradeCode string `description:"指标唯一编码"`
  17. Close string `description:"录入值"`
  18. }
  19. func BatchEdbData(oldCreateDate, createDate string, list []EdbDataEdit, opUserId int) (failEdbDataList []EdbDataEdit, err error) {
  20. if oldCreateDate == createDate { //修改
  21. err = errors.New("开始日期与结束日期一致!")
  22. return
  23. }
  24. for _, newEdbData := range list {
  25. edbdata := new(models.Edbdata)
  26. edbdata.TradeCode = newEdbData.TradeCode
  27. edbdata.Dt = newEdbData.CreateDate
  28. edbdata.Close = newEdbData.Close
  29. edbdata.ModifyTime = time.Now()
  30. item, err := models.GetDataInfo(newEdbData.TradeCode, createDate)
  31. if err != nil && !utils.IsErrNoRow(err) {
  32. failEdbDataList = append(failEdbDataList, newEdbData)
  33. continue
  34. }
  35. if item == nil {
  36. _, err = models.AddEdbdata(edbdata)
  37. if err != nil {
  38. failEdbDataList = append(failEdbDataList, newEdbData)
  39. continue
  40. }
  41. } else {
  42. err = models.EditEdbdata(edbdata)
  43. if err != nil {
  44. failEdbDataList = append(failEdbDataList, newEdbData)
  45. continue
  46. }
  47. }
  48. oldItem, err := models.GetDataInfo(newEdbData.TradeCode, oldCreateDate)
  49. if err != nil && !utils.IsErrNoRow(err) {
  50. failEdbDataList = append(failEdbDataList, newEdbData)
  51. continue
  52. }
  53. if oldItem != nil {
  54. record := new(models.EdbdataDeleteRecord)
  55. record.TradeCode = oldItem.TradeCode
  56. record.Dt = oldItem.Dt
  57. record.Close = oldItem.Close
  58. record.ModifyTime = oldItem.ModifyTime
  59. record.CreateTime = time.Now()
  60. record.SysUserId = opUserId
  61. _, err = models.AddEdbdataDeleteRecord(record)
  62. if err != nil {
  63. failEdbDataList = append(failEdbDataList, newEdbData)
  64. continue
  65. }
  66. models.DeleteEdbData(newEdbData.TradeCode, newEdbData.OldCreateDate)
  67. }
  68. }
  69. return
  70. }
  71. func GetEdbDataTbz(edbInfo *data_manage.EdbInfo, tmpDataList []*data_manage.EdbDataList, startDateTime time.Time) (dataList []*data_manage.EdbDataList, minValue, maxValue float64, err error) {
  72. dataList = make([]*data_manage.EdbDataList, 0)
  73. var dateArr []string
  74. dataMap := make(map[string]*data_manage.EdbDataList)
  75. for _, v := range tmpDataList {
  76. dateArr = append(dateArr, v.DataTime)
  77. dataMap[v.DataTime] = v
  78. }
  79. for _, av := range dateArr {
  80. currentItem, ok := dataMap[av]
  81. if !ok {
  82. continue
  83. }
  84. tmpItem := *currentItem
  85. var isOk bool //是否计算出来结果
  86. currentDate, tmpErr := time.ParseInLocation(utils.FormatDate, av, time.Local)
  87. if tmpErr != nil {
  88. err = tmpErr
  89. return
  90. }
  91. if !startDateTime.IsZero() && currentDate.Before(startDateTime) {
  92. continue
  93. }
  94. preDate := currentDate.AddDate(-1, 0, 0)
  95. preDateStr := preDate.Format(utils.FormatDate)
  96. if findItem, ok := dataMap[preDateStr]; ok { //上一年同期找到
  97. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  98. isOk = true
  99. } else {
  100. if edbInfo.Frequency == "月度" { //向上和向下,各找一个月
  101. for i := 0; i <= 35; i++ {
  102. nextDateDay := preDate.AddDate(0, 0, i)
  103. nextDateDayStr := nextDateDay.Format(utils.FormatDate)
  104. if findItem, ok := dataMap[nextDateDayStr]; ok { //上一年同期->下一个月找到
  105. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  106. isOk = true
  107. break
  108. } else {
  109. preDateDay := preDate.AddDate(0, 0, -i)
  110. preDateDayStr := preDateDay.Format(utils.FormatDate)
  111. if findItem, ok := dataMap[preDateDayStr]; ok { //上一年同期->上一个月找到
  112. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  113. isOk = true
  114. break
  115. }
  116. }
  117. }
  118. } else if edbInfo.Frequency == "季度" || edbInfo.Frequency == "年度" {
  119. if findItem, ok := dataMap[preDateStr]; ok { //上一年同期->下一个月找到
  120. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  121. isOk = true
  122. break
  123. }
  124. } else {
  125. nextDateDay := preDate.AddDate(0, 0, 1)
  126. nextDateDayStr := nextDateDay.Format(utils.FormatDate)
  127. preDateDay := preDate.AddDate(0, 0, -1)
  128. preDateDayStr := preDateDay.Format(utils.FormatDate)
  129. for i := 0; i < 35; i++ {
  130. if i >= 1 {
  131. nextDateDay = nextDateDay.AddDate(0, 0, i)
  132. nextDateDayStr = nextDateDay.Format(utils.FormatDate)
  133. }
  134. if findItem, ok := dataMap[nextDateDayStr]; ok { //上一年同期->下一个月找到
  135. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  136. isOk = true
  137. break
  138. } else {
  139. if i >= 1 {
  140. preDateDay = preDate.AddDate(0, 0, -i)
  141. preDateDayStr = nextDateDay.Format(utils.FormatDate)
  142. }
  143. if findItem, ok := dataMap[preDateDayStr]; ok { //上一年同期->上一个月找到
  144. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  145. isOk = true
  146. break
  147. }
  148. }
  149. }
  150. }
  151. }
  152. if isOk {
  153. if tmpItem.Value > maxValue {
  154. maxValue = tmpItem.Value
  155. }
  156. if tmpItem.Value < minValue {
  157. minValue = tmpItem.Value
  158. }
  159. dataList = append(dataList, &tmpItem)
  160. }
  161. }
  162. return
  163. }
  164. func GetChartEdbSeasonalData(calendar, startDate, endDate string, edbInfo *data_manage.EdbInfo) (resultData interface{}, err error) {
  165. var startDateReal string
  166. startDateReal = startDate
  167. calendarPreYear := 0
  168. if calendar == "农历" {
  169. newStartDateReal, tmpErr := time.Parse(utils.FormatDate, startDateReal)
  170. if tmpErr != nil {
  171. err = tmpErr
  172. fmt.Println("time.Parse:" + err.Error())
  173. return
  174. }
  175. calendarPreYear = newStartDateReal.Year() - 1
  176. newStartDateReal = newStartDateReal.AddDate(-1, 0, 0)
  177. startDateReal = newStartDateReal.Format(utils.FormatDate)
  178. }
  179. dataList := make([]*data_manage.EdbDataList, 0)
  180. switch edbInfo.EdbInfoType {
  181. case 0:
  182. dataList, err = data_manage.GetEdbDataList(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbInfoId, startDateReal, endDate)
  183. case 1:
  184. _, dataList, _, _, err, _ = GetPredictDataListByPredictEdbInfoId(edbInfo.EdbInfoId, startDateReal, endDate, false)
  185. default:
  186. err = errors.New(fmt.Sprint("获取失败,指标类型异常", edbInfo.EdbInfoType))
  187. }
  188. if err != nil {
  189. return
  190. }
  191. latestDateStr := edbInfo.LatestDate //实际数据的截止日期
  192. latestDate, tmpErr := time.Parse(utils.FormatDate, edbInfo.LatestDate)
  193. if tmpErr != nil {
  194. err = errors.New(fmt.Sprint("获取最后实际数据的日期失败,Err:" + tmpErr.Error() + ";LatestDate:" + edbInfo.LatestDate))
  195. return
  196. }
  197. latestDateYear := latestDate.Year() //实际数据截止年份
  198. if calendar == "农历" {
  199. if len(dataList) <= 0 {
  200. resultData = new(data_manage.EdbDataResult)
  201. } else {
  202. result, tmpErr := data_manage.AddCalculateQuarterV4(dataList)
  203. if tmpErr != nil {
  204. err = errors.New("获取农历数据失败,Err:" + tmpErr.Error())
  205. return
  206. }
  207. for k, edbDataItems := range result.List {
  208. var cuttingDataTimestamp int64
  209. cuttingDataTimeStr := latestDate.AddDate(0, 0, edbDataItems.BetweenDay).Format(utils.FormatDate)
  210. if edbDataItems.Year >= latestDateYear {
  211. for _, tmpData := range edbDataItems.Items {
  212. if tmpData.DataTime == cuttingDataTimeStr {
  213. cuttingDataTimestamp = tmpData.DataTimestamp
  214. break
  215. }
  216. }
  217. }
  218. edbDataItems.CuttingDataTimestamp = cuttingDataTimestamp
  219. result.List[k] = edbDataItems
  220. }
  221. if result.List[0].Year != calendarPreYear {
  222. itemList := make([]*data_manage.EdbDataList, 0)
  223. items := new(data_manage.EdbDataItems)
  224. items.Items = itemList
  225. newResult := new(data_manage.EdbDataResult)
  226. newResult.List = append(newResult.List, items)
  227. newResult.List = append(newResult.List, result.List...)
  228. resultData = newResult
  229. } else {
  230. resultData = result
  231. }
  232. }
  233. } else {
  234. currentYear := time.Now().Year()
  235. quarterDataList := make([]*data_manage.QuarterData, 0)
  236. quarterMap := make(map[int][]*data_manage.EdbDataList)
  237. var quarterArr []int
  238. for _, v := range dataList {
  239. itemDate, tmpErr := time.Parse(utils.FormatDate, v.DataTime)
  240. if tmpErr != nil {
  241. err = errors.New("季度指标日期转换,Err:" + tmpErr.Error() + ";DataTime:" + v.DataTime)
  242. return
  243. }
  244. year := itemDate.Year()
  245. newItemDate := itemDate.AddDate(currentYear-year, 0, 0)
  246. timestamp := newItemDate.UnixNano() / 1e6
  247. v.DataTimestamp = timestamp
  248. if findVal, ok := quarterMap[year]; !ok {
  249. quarterArr = append(quarterArr, year)
  250. findVal = append(findVal, v)
  251. quarterMap[year] = findVal
  252. } else {
  253. findVal = append(findVal, v)
  254. quarterMap[year] = findVal
  255. }
  256. }
  257. for _, v := range quarterArr {
  258. itemList := quarterMap[v]
  259. quarterItem := new(data_manage.QuarterData)
  260. quarterItem.Year = v
  261. quarterItem.DataList = itemList
  262. if v == latestDateYear {
  263. var cuttingDataTimestamp int64
  264. for _, tmpData := range itemList {
  265. if tmpData.DataTime == latestDateStr {
  266. cuttingDataTimestamp = tmpData.DataTimestamp
  267. break
  268. }
  269. }
  270. quarterItem.CuttingDataTimestamp = cuttingDataTimestamp
  271. } else if v > latestDateYear {
  272. if len(itemList) > 0 {
  273. quarterItem.CuttingDataTimestamp = itemList[0].DataTimestamp - 100
  274. }
  275. }
  276. quarterDataList = append(quarterDataList, quarterItem)
  277. }
  278. resultData = quarterDataList
  279. }
  280. return
  281. }
  282. func TbzDiv(a, b float64) float64 {
  283. var valFloat float64
  284. if b != 0 {
  285. af := decimal.NewFromFloat(a)
  286. bf := decimal.NewFromFloat(b)
  287. val, _ := af.Div(bf).Float64()
  288. val = val - 1
  289. valFloat, _ = decimal.NewFromFloat(val).Round(4).Float64()
  290. } else {
  291. valFloat = 0
  292. }
  293. return valFloat
  294. }
  295. func GetDateData(edbInfo *data_manage.EdbInfo, startDate, endDate string) (item *data_manage.EdbDataList, err error) {
  296. var dataList []*data_manage.EdbDataList
  297. switch edbInfo.EdbInfoType {
  298. case 0:
  299. dataList, err = data_manage.GetEdbDataList(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbInfoId, startDate, endDate)
  300. case 1:
  301. _, dataList, _, _, err, _ = GetPredictDataListByPredictEdbInfoId(edbInfo.EdbInfoId, startDate, endDate, false)
  302. default:
  303. err = errors.New(fmt.Sprint("获取失败,指标类型异常", edbInfo.EdbInfoType))
  304. }
  305. if err != nil {
  306. return
  307. }
  308. if len(dataList) <= 0 {
  309. return
  310. }
  311. item = dataList[0]
  312. return
  313. }
  314. func GetEdbBeforeAndAfterDateData(targetDate string, dataList []*data_manage.EdbDataList) (list []*data_manage.EdbDataList, err error) {
  315. lenDataList := len(dataList)
  316. if lenDataList <= 0 {
  317. return
  318. }
  319. maxIndex := lenDataList - 1
  320. startIndex := 0
  321. endIndex := 0
  322. for index, v := range dataList {
  323. if v.DataTime == targetDate {
  324. if index+2 > maxIndex {
  325. endIndex = maxIndex
  326. } else if index+1 > maxIndex {
  327. endIndex = maxIndex
  328. } else {
  329. endIndex = index + 2
  330. }
  331. startIndex = endIndex - 4
  332. if startIndex < 0 {
  333. startIndex = 0
  334. }
  335. if endIndex == maxIndex {
  336. list = dataList[startIndex:]
  337. } else {
  338. list = dataList[startIndex : endIndex+1]
  339. }
  340. break
  341. }
  342. }
  343. return
  344. }
  345. func GetPageData(edbInfoId, source, subSource int, endDataTime string, startSize, pageSize int) (dataCount int, dataList []*data_manage.EdbData, err error) {
  346. dataList = make([]*data_manage.EdbData, 0)
  347. if source == utils.DATA_SOURCE_BUSINESS && utils.UseMongo {
  348. return getPageDataByMongo(edbInfoId, source, subSource, endDataTime, startSize, pageSize)
  349. }
  350. if source == utils.DATA_SOURCE_THS && subSource == utils.DATA_SUB_SOURCE_HIGH_FREQUENCY && utils.UseMongo {
  351. return getThsHfPageDataByMongo(edbInfoId, source, subSource, endDataTime, startSize, pageSize)
  352. }
  353. return getPageDataByMysql(edbInfoId, source, subSource, endDataTime, startSize, pageSize)
  354. }
  355. func getPageDataByMysql(edbInfoId, source, subSource int, endDataTime string, startSize, pageSize int) (dataCount int, dataList []*data_manage.EdbData, err error) {
  356. dataList = make([]*data_manage.EdbData, 0)
  357. var dataCondition string
  358. var dataPars []interface{}
  359. dataCondition += ` AND edb_info_id=? `
  360. dataPars = append(dataPars, edbInfoId)
  361. if endDataTime != "" {
  362. dataCondition += ` AND data_time <= ? `
  363. dataPars = append(dataPars, endDataTime)
  364. }
  365. dataCount, err = data_manage.GetEdbDataCountByCondition(dataCondition, dataPars, source, subSource)
  366. if err != nil && !utils.IsErrNoRow(err) {
  367. return
  368. }
  369. dataList, err = data_manage.GetEdbDataListByCondition(dataCondition, dataPars, source, subSource, pageSize, startSize)
  370. if err != nil {
  371. return
  372. }
  373. return
  374. }
  375. func getPageDataByMongo(edbInfoId, source, subSource int, endDataTime string, startSize, pageSize int) (dataCount int, dataList []*data_manage.EdbData, err error) {
  376. dataList = make([]*data_manage.EdbData, 0)
  377. mogDataObj := mgo.EdbDataBusiness{}
  378. queryConditions := bson.M{
  379. "edb_info_id": edbInfoId,
  380. }
  381. dateCondition, err := mgo.BuildDateCondition("", endDataTime)
  382. if err != nil {
  383. return
  384. }
  385. if len(dateCondition) > 0 {
  386. queryConditions["data_time"] = dateCondition
  387. }
  388. tmpCount, tmpErr := mogDataObj.GetCountDataList(queryConditions)
  389. if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
  390. err = tmpErr
  391. return
  392. }
  393. dataCount = int(tmpCount)
  394. tmpDataList, tmpErr := mogDataObj.GetPageDataList(queryConditions, int64(startSize), int64(pageSize), []string{"-data_time"})
  395. if tmpErr != nil {
  396. err = tmpErr
  397. return
  398. }
  399. for k, v := range tmpDataList {
  400. dataList = append(dataList, &data_manage.EdbData{
  401. EdbDataId: k + 1,
  402. EdbInfoId: v.EdbInfoId,
  403. DataTime: v.DataTime.Format(utils.FormatDate),
  404. Value: v.Value,
  405. })
  406. }
  407. return
  408. }
  409. func GetEdbDataTbzForSeason(frequency string, tmpDataList []*data_manage.EdbDataList, startDateTime time.Time) (dataList []*data_manage.EdbDataList, minValue, maxValue float64, err error) {
  410. dataList = make([]*data_manage.EdbDataList, 0)
  411. var dateArr []string
  412. dataMap := make(map[string]*data_manage.EdbDataList)
  413. for _, v := range tmpDataList {
  414. dateArr = append(dateArr, v.DataTime)
  415. dataMap[v.DataTime] = v
  416. }
  417. for _, av := range dateArr {
  418. currentItem, ok := dataMap[av]
  419. if !ok {
  420. continue
  421. }
  422. tmpItem := *currentItem
  423. var isOk bool //是否计算出来结果
  424. currentDate, tmpErr := time.ParseInLocation(utils.FormatDate, av, time.Local)
  425. if tmpErr != nil {
  426. err = tmpErr
  427. return
  428. }
  429. if !startDateTime.IsZero() && currentDate.Before(startDateTime) {
  430. continue
  431. }
  432. preDate := currentDate.AddDate(-1, 0, 0)
  433. preDateStr := preDate.Format(utils.FormatDate)
  434. if findItem, ok := dataMap[preDateStr]; ok { //上一年同期找到
  435. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  436. isOk = true
  437. } else {
  438. if frequency == "月度" { //向上和向下,各找一个月
  439. for i := 0; i <= 35; i++ {
  440. nextDateDay := preDate.AddDate(0, 0, i)
  441. nextDateDayStr := nextDateDay.Format(utils.FormatDate)
  442. if findItem, ok := dataMap[nextDateDayStr]; ok { //上一年同期->下一个月找到
  443. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  444. isOk = true
  445. break
  446. } else {
  447. preDateDay := preDate.AddDate(0, 0, -i)
  448. preDateDayStr := preDateDay.Format(utils.FormatDate)
  449. if findItem, ok := dataMap[preDateDayStr]; ok { //上一年同期->上一个月找到
  450. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  451. isOk = true
  452. break
  453. }
  454. }
  455. }
  456. } else if frequency == "季度" || frequency == "年度" {
  457. if findItem, ok := dataMap[preDateStr]; ok { //上一年同期->下一个月找到
  458. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  459. isOk = true
  460. break
  461. }
  462. } else {
  463. nextDateDay := preDate.AddDate(0, 0, 1)
  464. nextDateDayStr := nextDateDay.Format(utils.FormatDate)
  465. preDateDay := preDate.AddDate(0, 0, -1)
  466. preDateDayStr := preDateDay.Format(utils.FormatDate)
  467. for i := 0; i < 35; i++ {
  468. if i >= 1 {
  469. nextDateDay = nextDateDay.AddDate(0, 0, i)
  470. nextDateDayStr = nextDateDay.Format(utils.FormatDate)
  471. }
  472. if findItem, ok := dataMap[nextDateDayStr]; ok { //上一年同期->下一个月找到
  473. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  474. isOk = true
  475. break
  476. } else {
  477. if i >= 1 {
  478. preDateDay = preDate.AddDate(0, 0, -i)
  479. preDateDayStr = nextDateDay.Format(utils.FormatDate)
  480. }
  481. if findItem, ok := dataMap[preDateDayStr]; ok { //上一年同期->上一个月找到
  482. tmpItem.Value = TbzDiv(currentItem.Value, findItem.Value)
  483. isOk = true
  484. break
  485. }
  486. }
  487. }
  488. }
  489. }
  490. if isOk {
  491. if tmpItem.Value > maxValue {
  492. maxValue = tmpItem.Value
  493. }
  494. if tmpItem.Value < minValue {
  495. minValue = tmpItem.Value
  496. }
  497. dataList = append(dataList, &tmpItem)
  498. }
  499. }
  500. return
  501. }
  502. func getThsHfPageDataByMongo(edbInfoId, source, subSource int, endDataTime string, startSize, pageSize int) (dataCount int, dataList []*data_manage.EdbData, err error) {
  503. dataList = make([]*data_manage.EdbData, 0)
  504. mogDataObj := mgo.EdbDataThsHf{}
  505. queryConditions := bson.M{
  506. "edb_info_id": edbInfoId,
  507. }
  508. dateCondition, err := mgo.BuildDateCondition("", endDataTime)
  509. if err != nil {
  510. return
  511. }
  512. if len(dateCondition) > 0 {
  513. queryConditions["data_time"] = dateCondition
  514. }
  515. tmpCount, tmpErr := mogDataObj.GetCountDataList(queryConditions)
  516. if tmpErr != nil && !utils.IsErrNoRow(tmpErr) {
  517. err = tmpErr
  518. return
  519. }
  520. dataCount = int(tmpCount)
  521. tmpDataList, tmpErr := mogDataObj.GetPageDataList(queryConditions, int64(startSize), int64(pageSize), []string{"-data_time"})
  522. if tmpErr != nil {
  523. err = tmpErr
  524. return
  525. }
  526. for k, v := range tmpDataList {
  527. dataList = append(dataList, &data_manage.EdbData{
  528. EdbDataId: k + 1,
  529. EdbInfoId: v.EdbInfoId,
  530. DataTime: v.DataTime.Format(utils.FormatDate),
  531. Value: v.Value,
  532. })
  533. }
  534. return
  535. }