初始化2
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// StepCriterion 工序步骤考核标准:如 扭矩在RANGE[35,45] 自动判定 OK
|
||||
type StepCriterion struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (StepCriterion) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "step_criterion"}}
|
||||
}
|
||||
|
||||
func (StepCriterion) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive(),
|
||||
field.Int("stepId").Comment("步骤ID"),
|
||||
field.String("name").MaxLen(64).Comment("指标名,如 扭矩/角度"),
|
||||
field.String("unit").Default("").MaxLen(16),
|
||||
// GE / LE / GT / LT / RANGE / EQUAL / NONE
|
||||
field.String("logic").Default("NONE").MaxLen(16),
|
||||
field.Float("target").Default(0).Comment("目标值"),
|
||||
field.Float("min").Optional().Nillable().Comment("范围下限"),
|
||||
field.Float("max").Optional().Nillable().Comment("范围上限"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable(),
|
||||
}
|
||||
}
|
||||
|
||||
func (StepCriterion) Indexes() []ent.Index {
|
||||
return []ent.Index{index.Fields("stepId")}
|
||||
}
|
||||
Reference in New Issue
Block a user