提交 43f2b17d 编写于 作者: J Jason

优化

上级 edc369b6
......@@ -15,16 +15,19 @@ type Project struct {
}
type ProjectBase struct {
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Name string `json:"name"`
Description string `json:"description"`
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Name string `json:"name"`
//Description string `json:"description"`
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
}
type ProjectAdapter struct {
ProjectBase `xorm:"extends"`
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Name string `json:"name"`
//Description string `json:"description"`
ProtocolName string `json:"protocol_name"`
ProtocolOpts string `json:"protocol_opts"`
......@@ -32,15 +35,22 @@ type ProjectAdapter struct {
PollingEnable bool `json:"polling_enable"` //轮询
PollingInterval int `json:"polling_interval"` //轮询间隔 ms
PollingCycle int `json:"polling_cycle"` //轮询周期 s
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
}
type ProjectVariable struct {
ProjectBase `xorm:"extends"`
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Address `xorm:"extends"`
Type string `json:"type"`
Unit string `json:"unit"` //单位
Name string `json:"name"`
Alias string `json:"alias"`
Type string `json:"type"`
Unit string `json:"unit"` //单位
Scale float32 `json:"scale"` //倍率,比如一般是 整数÷10,得到
Default string `json:"default"`
......@@ -50,30 +60,44 @@ type ProjectVariable struct {
Cron string `json:"cron"`
PollingEnable bool `json:"polling_enable"` //轮询
PollingTimes int `json:"polling_times"`
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
}
type ProjectBatch struct {
ProjectBase `xorm:"extends"`
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Address `xorm:"extends"`
Size int `json:"size"`
//采样:无、定时、轮询
Cron string `json:"cron"`
PollingEnable bool `json:"polling_enable"` //轮询
PollingTimes int `json:"polling_times"`
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
}
type ProjectJob struct {
ProjectBase `xorm:"extends"`
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Name string `json:"name"`
Cron string `json:"cron"`
Script string `json:"script"` //javascript
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
}
type ProjectStrategy struct {
ProjectBase `xorm:"extends"`
Id int64 `json:"id"`
ProjectId int64 `json:"project_id"`
Name string `json:"name"`
Script string `json:"script"` //javascript
Created time.Time `json:"created" xorm:"created"`
Updated time.Time `json:"updated" xorm:"updated"`
}
......@@ -12,13 +12,8 @@ type Template struct {
Strategies []TemplateStrategy `json:"strategies"`
}
type TemplateBase struct {
Name string `json:"name"`
Description string `json:"description"`
}
type TemplateAdapter struct {
TemplateBase `xorm:"extends"`
Name string `json:"name"`
ProtocolName string `json:"protocol_name"`
ProtocolOpts string `json:"protocol_opts"`
......@@ -29,12 +24,12 @@ type TemplateAdapter struct {
}
type TemplateVariable struct {
TemplateBase `xorm:"extends"`
Address `xorm:"extends"`
Type string `json:"type"`
Unit string `json:"unit"` //单位
Name string `json:"name"`
Alias string `json:"alias"`
Type string `json:"type"`
Unit string `json:"unit"` //单位
Scale float32 `json:"scale"` //倍率,比如一般是 整数÷10,得到
Default string `json:"default"`
......@@ -47,12 +42,9 @@ type TemplateVariable struct {
}
type TemplateBatch struct {
TemplateBase `xorm:"extends"`
Address `xorm:"extends"`
Size int `json:"size"`
//采样:无、定时、轮询
Cron string `json:"cron"`
PollingEnable bool `json:"polling_enable"` //轮询
......@@ -60,15 +52,12 @@ type TemplateBatch struct {
}
type TemplateJob struct {
TemplateBase `xorm:"extends"`
Name string `json:"name"`
Cron string `json:"cron"`
Script string `json:"script"` //javascript
}
type TemplateStrategy struct {
TemplateBase `xorm:"extends"`
Name string `json:"name"`
Script string `json:"script"` //javascript
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册