/
tdengine.go
87 lines (76 loc) · 3.13 KB
/
tdengine.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"database/sql"
"github.com/sagoo-cloud/sagooiot/internal/model"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
type (
ITdEngine interface {
GetConn(ctx context.Context, dbName string) (db *sql.DB, err error)
GetTdEngineAllDb(ctx context.Context) (data []string, err error)
GetListTableByDatabases(ctx context.Context, dbName string) (data []*model.TDEngineTablesList, err error)
GetTdEngineTableInfoByTable(ctx context.Context, dbName string, tableName string) (data []*model.TDEngineTableInfo, err error)
GetTdEngineTableDataByTable(ctx context.Context, dbName string, tableName string) (data *model.TableDataInfo, err error)
GetOne(ctx context.Context, sql string, args ...any) (rs gdb.Record, err error)
GetAll(ctx context.Context, sql string, args ...any) (rs gdb.Result, err error)
Time(v *g.Var) (rs *g.Var)
}
ITdLogTable interface {
CreateStable(ctx context.Context) (err error)
Insert(ctx context.Context, log *model.TdLogAddInput) (err error)
Clear(ctx context.Context) (err error)
GetAll(ctx context.Context, sql string, args ...any) (list []model.TdLog, err error)
}
ITSLTable interface {
Insert(ctx context.Context, deviceKey string, data map[string]any) (err error)
CreateStable(ctx context.Context, tsl *model.TSL) (err error)
CreateTable(ctx context.Context, stable, table string) (err error)
DropStable(ctx context.Context, table string) (err error)
DropTable(ctx context.Context, table string) (err error)
CreateDatabase(ctx context.Context) (err error)
AddDatabaseField(ctx context.Context, tableName, fieldName string, dataType string, len int) (err error)
DelDatabaseField(ctx context.Context, tableName, fieldName string) (err error)
ModifyDatabaseField(ctx context.Context, tableName, fieldName string, dataType string, len int) (err error)
AddTag(ctx context.Context, tableName, tagName string, dataType string, len int) (err error)
DelTag(ctx context.Context, tableName, tagName string) (err error)
ModifyTag(ctx context.Context, tableName, tagName string, dataType string, len int) (err error)
}
)
var (
localTdLogTable ITdLogTable
localTSLTable ITSLTable
localTdEngine ITdEngine
)
func TdEngine() ITdEngine {
if localTdEngine == nil {
panic("implement not found for interface ITdEngine, forgot register?")
}
return localTdEngine
}
func RegisterTdEngine(i ITdEngine) {
localTdEngine = i
}
func TdLogTable() ITdLogTable {
if localTdLogTable == nil {
panic("implement not found for interface ITdLogTable, forgot register?")
}
return localTdLogTable
}
func RegisterTdLogTable(i ITdLogTable) {
localTdLogTable = i
}
func TSLTable() ITSLTable {
if localTSLTable == nil {
panic("implement not found for interface ITSLTable, forgot register?")
}
return localTSLTable
}
func RegisterTSLTable(i ITSLTable) {
localTSLTable = i
}