Files
bj_power/bj_power_mes/schema/signal.go
T

32 lines
840 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
)
type Signal struct {
ent.Schema
}
func (Signal) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "signal"},
entsql.WithComments(true),
}
}
func (Signal) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("isStatus").Comment("信号状态(0:任务信号,1:状态信号)"),
field.String("name").NotEmpty().Unique().Comment("信号名称"),
field.Int("sender").Default(1).Comment("发送方(1pc2plc"),
field.String("address").Comment("PLC地址"),
field.Int("replyOffset").Default(9).Comment("回复地址偏移量"),
field.String("description").MaxLen(60).Optional().Comment("信号描述"),
}
}