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

优化

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