model.go 1.5 KB
Newer Older
1
package types
J
Jason 已提交
2

J
Jason 已提交
3
type _base struct {
4 5
	Id          int    `json:"id" storm:"id,increment"`
	ModelId     int    `json:"model_id"`
J
Jason 已提交
6 7
	Name        string `json:"name"`
	Description string `json:"description"`
J
Jason 已提交
8
}
J
Jason 已提交
9

10 11 12
type ModelTunnel struct {
	_base    `storm:"inline"`
	LinkId   int    `json:"link_id"`
J
Jason 已提交
13
	Protocol string `json:"protocol"`
J
Jason 已提交
14 15
}

16
type ModelVariable struct {
17 18
	_base    `storm:"inline"`
	TunnelId int    `json:"tunnel_id"`
J
Jason 已提交
19 20 21 22
	Type     string `json:"type"`
	Addr     string `json:"addr"`
	Default  string `json:"default"`
	Writable bool   `json:"writable"` //可写,用于输出(如开关)
J
Jason 已提交
23

J
Jason 已提交
24 25 26
	//TODO 采样:无、定时、轮询
	Cron string `json:"cron"`

27
	Children []ModelVariable `json:"children"`
J
Jason 已提交
28 29
}

30 31 32 33 34 35
type ModelBatchResult struct {
	Offset   int    `json:"offset"`
	Variable string `json:"variable"` //ModelVariable path
}

type ModelBatch struct {
36 37 38 39 40 41
	_base    `storm:"inline"`
	TunnelId int    `json:"tunnel_id"`
	Type     string `json:"type"`
	Addr     string `json:"addr"`
	Size     int    `json:"size"`
	Cron     string `json:"cron"`
J
Jason 已提交
42

43
	Results []ModelBatchResult `json:"results"`
J
Jason 已提交
44
}
J
Jason 已提交
45

46
type ModelJob struct {
47
	_base  `storm:"inline"`
J
Jason 已提交
48
	Cron   string `json:"cron"`
J
Jason 已提交
49
	Script string `json:"script"` //javascript
J
Jason 已提交
50 51
}

52
type ModelStrategy struct {
53
	_base  `storm:"inline"`
J
Jason 已提交
54
	Script string `json:"script"` //javascript
J
Jason 已提交
55 56
}

57
type Model struct {
58 59 60 61 62
	Id          int    `json:"id" storm:"id,increment"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	H5          string `json:"h5"`
J
Jason 已提交
63
}