package models import ( "errors" "github.com/jinzhu/gorm" ) // RuleChain 规则链 type RuleChain struct { gorm.Model RecordId string `gorm:"column:record_id;size:32;index"` AdditionalInfo string `gorm:"column:additional_info"` //节点属性信息 Configuration string `gorm:"column:configuration"` //配置信息 Name string `gorm:"column:name"` //名称 FirstRuleNodeID string `gorm:"column:first_rule_node_id"` //第一个节点的ID Root bool `gorm:"column:root"` //是否为root chain DebugModel bool `gorm:"column:debug_model"` //调试模式 Intro string `gorm:"column:intro"` //描述 VendorID string `gorm:"column:vendor_id"` //厂商ID } type Cells []*Cell type Cell struct { Id string `json:"id"` // id Data CellData `json:"data"` // 数据 } type CellData struct { Name string `json:"name"` // 名称 Id string `json:"id"` // id Type string `json:"type"` // 节点类型 Desc string `json:"desc"` // 备注 ZIndex string `json:"ZIndex"` // 序号 Shape string `json:"shape"` // 类型 FuncBody string `json:"func_body"` // 代码 Labels []string `json:"labels"` Source string `json:"source"` // 源节点id Target string `json:"target"` // 目标节点id Headers []*Headers `json:"headers"` } type NodeConfiguration struct { Url string `json:"url"` Method string `json:"method"` Headers map[string]string `json:"headers"` Retry int `json:"retry"` TimeOut int `json:"time_out"` RetryWait int `json:"retry_wait"` } type Headers struct { Key string `json:"key"` Value string `json:"value"` } // Validate `` func (a *RuleChain) Validate() error { if a.Name == "" { return errors.New("规则链名称为空") } return nil }