尝试给上报到elasticsearch的文档加_id

This commit is contained in:
zhangkun 2024-12-03 23:11:13 +08:00
parent c8f9cebc5b
commit 193ea03604
2 changed files with 2 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import (
type Candle struct { type Candle struct {
core *Core core *Core
Id string `json:"_id"`
InstId string InstId string
Period string Period string
Data []interface{} Data []interface{}
@ -175,6 +176,7 @@ func Daoxu(arr []interface{}) {
func (cl *Candle) ToStruct(core *Core) error { func (cl *Candle) ToStruct(core *Core) error {
// cl.Timestamp // cl.Timestamp
cl.Id = cl.InstId + "." + cl.Period + "." + cl.Data[0].(string)
// 将字符串转换为 int64 类型的时间戳 // 将字符串转换为 int64 类型的时间戳
ts, err := strconv.ParseInt(cl.Data[0].(string), 10, 64) ts, err := strconv.ParseInt(cl.Data[0].(string), 10, 64)
if err != nil { if err != nil {

BIN
tunas

Binary file not shown.