feat:多项功能优化
This commit is contained in:
@@ -27,6 +27,10 @@ type Station struct {
|
||||
StationType string `json:"stationType,omitempty"`
|
||||
// Status holds the value of the "status" field.
|
||||
Status string `json:"status,omitempty"`
|
||||
// 内置工位:不可改类型/不可删除
|
||||
IsBuiltin bool `json:"isBuiltin,omitempty"`
|
||||
// 是否有接驳台(实体位置,内置不可改)
|
||||
HasDock bool `json:"hasDock,omitempty"`
|
||||
// CreatedAt holds the value of the "createdAt" field.
|
||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
@@ -37,6 +41,8 @@ func (*Station) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case station.FieldIsBuiltin, station.FieldHasDock:
|
||||
values[i] = new(sql.NullBool)
|
||||
case station.FieldID, station.FieldStationNo, station.FieldFlowId:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case station.FieldName, station.FieldStationType, station.FieldStatus:
|
||||
@@ -94,6 +100,18 @@ func (_m *Station) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.Status = value.String
|
||||
}
|
||||
case station.FieldIsBuiltin:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field isBuiltin", values[i])
|
||||
} else if value.Valid {
|
||||
_m.IsBuiltin = value.Bool
|
||||
}
|
||||
case station.FieldHasDock:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field hasDock", values[i])
|
||||
} else if value.Valid {
|
||||
_m.HasDock = value.Bool
|
||||
}
|
||||
case station.FieldCreatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field createdAt", values[i])
|
||||
@@ -151,6 +169,12 @@ func (_m *Station) String() string {
|
||||
builder.WriteString("status=")
|
||||
builder.WriteString(_m.Status)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("isBuiltin=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.IsBuiltin))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("hasDock=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.HasDock))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("createdAt=")
|
||||
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteByte(')')
|
||||
|
||||
Reference in New Issue
Block a user