Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
microrain authored and microrain committed Aug 12, 2023
2 parents 1191964 + d33b9f8 commit 86af7be
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions internal/logic/tdengine/tsl_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package tdengine
import (
"context"
"fmt"
"github.com/sagoo-cloud/sagooiot/internal/model"
"github.com/sagoo-cloud/sagooiot/internal/service"
"strconv"
"strings"

"github.com/sagoo-cloud/sagooiot/internal/model"
"github.com/sagoo-cloud/sagooiot/internal/service"

"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
Expand Down Expand Up @@ -76,7 +77,7 @@ func (s *sTSLTable) CreateStable(ctx context.Context, tsl *model.TSL) (err error

// 标签字段
tags := make([]string, len(tsl.Tags)+1)
tags[0] = "device VARCHAR(255) COMMENT '设备标识'"
tags[0] = "device VARCHAR(255)"
for i, v := range tsl.Tags {
maxLength := 0
if v.ValueType.TSLParamBase.MaxLength != nil {
Expand Down Expand Up @@ -115,10 +116,6 @@ func (s *sTSLTable) CreateTable(ctx context.Context, stable, table string) (err

func (s *sTSLTable) column(dataType, key, name string, maxLength int) string {
column := ""
comment := ""
if name != "" {
comment = "COMMENT '" + name + "'"
}
tdType := ""
switch dataType {
case "int":
Expand All @@ -144,7 +141,7 @@ func (s *sTSLTable) column(dataType, key, name string, maxLength int) string {
}
tdType = "NCHAR(" + strconv.Itoa(maxLength) + ")"
}
column = fmt.Sprintf("%s %s %s", key, tdType, comment)
column = fmt.Sprintf("%s %s", key, tdType)
return column
}

Expand Down

0 comments on commit 86af7be

Please sign in to comment.