// Code generated by ent, DO NOT EDIT. package ent import ( "bj_power_wms/ent/dock" "fmt" "strings" "entgo.io/ent" "entgo.io/ent/dialect/sql" ) // Dock is the model entity for the Dock schema. type Dock struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // 接驳台编码 DOCK01..21 DockCode string `json:"dockCode,omitempty"` // 接驳台名称 Name string `json:"name,omitempty"` // 类型 line产线/store库房 DockType string `json:"dockType,omitempty"` // 关联工位号(产线 1..12),库房 0 StationNo int `json:"stationNo,omitempty"` // 当前是否有托盘 HasPallet bool `json:"hasPallet,omitempty"` // 托盘关联(出库单号/备料单号) PalletRef string `json:"palletRef,omitempty"` // Status holds the value of the "status" field. Status string `json:"status,omitempty"` // 创建时间 CreatedAt int64 `json:"createdAt,omitempty"` selectValues sql.SelectValues } // scanValues returns the types for scanning values from sql.Rows. func (*Dock) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case dock.FieldHasPallet: values[i] = new(sql.NullBool) case dock.FieldID, dock.FieldStationNo, dock.FieldCreatedAt: values[i] = new(sql.NullInt64) case dock.FieldDockCode, dock.FieldName, dock.FieldDockType, dock.FieldPalletRef, dock.FieldStatus: values[i] = new(sql.NullString) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Dock fields. func (_m *Dock) assignValues(columns []string, values []any) error { if m, n := len(values), len(columns); m < n { return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) } for i := range columns { switch columns[i] { case dock.FieldID: value, ok := values[i].(*sql.NullInt64) if !ok { return fmt.Errorf("unexpected type %T for field id", value) } _m.ID = int(value.Int64) case dock.FieldDockCode: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field dock_code", values[i]) } else if value.Valid { _m.DockCode = value.String } case dock.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = value.String } case dock.FieldDockType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field dock_type", values[i]) } else if value.Valid { _m.DockType = value.String } case dock.FieldStationNo: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field station_no", values[i]) } else if value.Valid { _m.StationNo = int(value.Int64) } case dock.FieldHasPallet: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field has_pallet", values[i]) } else if value.Valid { _m.HasPallet = value.Bool } case dock.FieldPalletRef: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field pallet_ref", values[i]) } else if value.Valid { _m.PalletRef = value.String } case dock.FieldStatus: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field status", values[i]) } else if value.Valid { _m.Status = value.String } case dock.FieldCreatedAt: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Int64 } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Dock. // This includes values selected through modifiers, order, etc. func (_m *Dock) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // Update returns a builder for updating this Dock. // Note that you need to call Dock.Unwrap() before calling this method if this Dock // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Dock) Update() *DockUpdateOne { return NewDockClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Dock entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (_m *Dock) Unwrap() *Dock { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Dock is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Dock) String() string { var builder strings.Builder builder.WriteString("Dock(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("dock_code=") builder.WriteString(_m.DockCode) builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(_m.Name) builder.WriteString(", ") builder.WriteString("dock_type=") builder.WriteString(_m.DockType) builder.WriteString(", ") builder.WriteString("station_no=") builder.WriteString(fmt.Sprintf("%v", _m.StationNo)) builder.WriteString(", ") builder.WriteString("has_pallet=") builder.WriteString(fmt.Sprintf("%v", _m.HasPallet)) builder.WriteString(", ") builder.WriteString("pallet_ref=") builder.WriteString(_m.PalletRef) builder.WriteString(", ") builder.WriteString("status=") builder.WriteString(_m.Status) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt)) builder.WriteByte(')') return builder.String() } // Docks is a parsable slice of Dock. type Docks []*Dock