Files
bj_power/bj_power_mes/ent/stationprocess.go
T

162 lines
5.3 KiB
Go
Raw Normal View History

2026-08-28 15:06:01 +08:00
// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/stationprocess"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// StationProcess is the model entity for the StationProcess schema.
type StationProcess struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 工位号 1..12
StationNo int `json:"stationNo,omitempty"`
// 工序代码
ProcessCode int `json:"processCode,omitempty"`
// 生效日期
EffectDate string `json:"effectDate,omitempty"`
// 班次
Shift string `json:"shift,omitempty"`
// Operator holds the value of the "operator" field.
Operator string `json:"operator,omitempty"`
// CreatedAt holds the value of the "createdAt" field.
CreatedAt time.Time `json:"createdAt,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*StationProcess) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case stationprocess.FieldID, stationprocess.FieldStationNo, stationprocess.FieldProcessCode:
values[i] = new(sql.NullInt64)
case stationprocess.FieldEffectDate, stationprocess.FieldShift, stationprocess.FieldOperator:
values[i] = new(sql.NullString)
case stationprocess.FieldCreatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the StationProcess fields.
func (_m *StationProcess) 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 stationprocess.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 stationprocess.FieldStationNo:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field stationNo", values[i])
} else if value.Valid {
_m.StationNo = int(value.Int64)
}
case stationprocess.FieldProcessCode:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field processCode", values[i])
} else if value.Valid {
_m.ProcessCode = int(value.Int64)
}
case stationprocess.FieldEffectDate:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field effectDate", values[i])
} else if value.Valid {
_m.EffectDate = value.String
}
case stationprocess.FieldShift:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field shift", values[i])
} else if value.Valid {
_m.Shift = value.String
}
case stationprocess.FieldOperator:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field operator", values[i])
} else if value.Valid {
_m.Operator = value.String
}
case stationprocess.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field createdAt", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the StationProcess.
// This includes values selected through modifiers, order, etc.
func (_m *StationProcess) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this StationProcess.
// Note that you need to call StationProcess.Unwrap() before calling this method if this StationProcess
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *StationProcess) Update() *StationProcessUpdateOne {
return NewStationProcessClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the StationProcess 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 *StationProcess) Unwrap() *StationProcess {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: StationProcess is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *StationProcess) String() string {
var builder strings.Builder
builder.WriteString("StationProcess(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("stationNo=")
builder.WriteString(fmt.Sprintf("%v", _m.StationNo))
builder.WriteString(", ")
builder.WriteString("processCode=")
builder.WriteString(fmt.Sprintf("%v", _m.ProcessCode))
builder.WriteString(", ")
builder.WriteString("effectDate=")
builder.WriteString(_m.EffectDate)
builder.WriteString(", ")
builder.WriteString("shift=")
builder.WriteString(_m.Shift)
builder.WriteString(", ")
builder.WriteString("operator=")
builder.WriteString(_m.Operator)
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// StationProcesses is a parsable slice of StationProcess.
type StationProcesses []*StationProcess