167 lines
5.4 KiB
Go
167 lines
5.4 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
||
|
||
package ent
|
||
|
||
import (
|
||
"bj_power_mes/ent/agvpoint"
|
||
"fmt"
|
||
"strings"
|
||
"time"
|
||
|
||
"entgo.io/ent"
|
||
"entgo.io/ent/dialect/sql"
|
||
)
|
||
|
||
// AgvPoint AGV 点位(硬件级别真源):点位编码与接驳台一一对应,软件仅可启用/停用与改显示名。
|
||
type AgvPoint struct {
|
||
config `json:"-"`
|
||
// ID of the ent.
|
||
ID int `json:"id,omitempty"`
|
||
// AGV 点位编码(硬件映射=送往 RCS 的目标坐标,软件不可改)
|
||
PositionCode string `json:"position_code,omitempty"`
|
||
// 点位显示名称(可编辑)
|
||
Name string `json:"name,omitempty"`
|
||
// 是否接驳台点位(true=绑定接驳台,false=纯待命/充电点位)
|
||
IsDock bool `json:"is_dock,omitempty"`
|
||
// 绑定的接驳台 ID(is_dock=true 时硬件内置强绑定)
|
||
DockID *int `json:"dock_id,omitempty"`
|
||
// 是否启用(可编辑)
|
||
Enabled bool `json:"enabled,omitempty"`
|
||
// CreatedAt holds the value of the "created_at" field.
|
||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||
selectValues sql.SelectValues
|
||
}
|
||
|
||
// scanValues returns the types for scanning values from sql.Rows.
|
||
func (*AgvPoint) scanValues(columns []string) ([]any, error) {
|
||
values := make([]any, len(columns))
|
||
for i := range columns {
|
||
switch columns[i] {
|
||
case agvpoint.FieldIsDock, agvpoint.FieldEnabled:
|
||
values[i] = new(sql.NullBool)
|
||
case agvpoint.FieldID, agvpoint.FieldDockID:
|
||
values[i] = new(sql.NullInt64)
|
||
case agvpoint.FieldPositionCode, agvpoint.FieldName:
|
||
values[i] = new(sql.NullString)
|
||
case agvpoint.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 AgvPoint fields.
|
||
func (_m *AgvPoint) 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 agvpoint.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 agvpoint.FieldPositionCode:
|
||
if value, ok := values[i].(*sql.NullString); !ok {
|
||
return fmt.Errorf("unexpected type %T for field position_code", values[i])
|
||
} else if value.Valid {
|
||
_m.PositionCode = value.String
|
||
}
|
||
case agvpoint.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 agvpoint.FieldIsDock:
|
||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||
return fmt.Errorf("unexpected type %T for field is_dock", values[i])
|
||
} else if value.Valid {
|
||
_m.IsDock = value.Bool
|
||
}
|
||
case agvpoint.FieldDockID:
|
||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||
return fmt.Errorf("unexpected type %T for field dock_id", values[i])
|
||
} else if value.Valid {
|
||
_m.DockID = new(int)
|
||
*_m.DockID = int(value.Int64)
|
||
}
|
||
case agvpoint.FieldEnabled:
|
||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||
return fmt.Errorf("unexpected type %T for field enabled", values[i])
|
||
} else if value.Valid {
|
||
_m.Enabled = value.Bool
|
||
}
|
||
case agvpoint.FieldCreatedAt:
|
||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||
return fmt.Errorf("unexpected type %T for field created_at", 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 AgvPoint.
|
||
// This includes values selected through modifiers, order, etc.
|
||
func (_m *AgvPoint) Value(name string) (ent.Value, error) {
|
||
return _m.selectValues.Get(name)
|
||
}
|
||
|
||
// Update returns a builder for updating this AgvPoint.
|
||
// Note that you need to call AgvPoint.Unwrap() before calling this method if this AgvPoint
|
||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||
func (_m *AgvPoint) Update() *AgvPointUpdateOne {
|
||
return NewAgvPointClient(_m.config).UpdateOne(_m)
|
||
}
|
||
|
||
// Unwrap unwraps the AgvPoint 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 *AgvPoint) Unwrap() *AgvPoint {
|
||
_tx, ok := _m.config.driver.(*txDriver)
|
||
if !ok {
|
||
panic("ent: AgvPoint is not a transactional entity")
|
||
}
|
||
_m.config.driver = _tx.drv
|
||
return _m
|
||
}
|
||
|
||
// String implements the fmt.Stringer.
|
||
func (_m *AgvPoint) String() string {
|
||
var builder strings.Builder
|
||
builder.WriteString("AgvPoint(")
|
||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||
builder.WriteString("position_code=")
|
||
builder.WriteString(_m.PositionCode)
|
||
builder.WriteString(", ")
|
||
builder.WriteString("name=")
|
||
builder.WriteString(_m.Name)
|
||
builder.WriteString(", ")
|
||
builder.WriteString("is_dock=")
|
||
builder.WriteString(fmt.Sprintf("%v", _m.IsDock))
|
||
builder.WriteString(", ")
|
||
if v := _m.DockID; v != nil {
|
||
builder.WriteString("dock_id=")
|
||
builder.WriteString(fmt.Sprintf("%v", *v))
|
||
}
|
||
builder.WriteString(", ")
|
||
builder.WriteString("enabled=")
|
||
builder.WriteString(fmt.Sprintf("%v", _m.Enabled))
|
||
builder.WriteString(", ")
|
||
builder.WriteString("created_at=")
|
||
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
|
||
builder.WriteByte(')')
|
||
return builder.String()
|
||
}
|
||
|
||
// AgvPoints is a parsable slice of AgvPoint.
|
||
type AgvPoints []*AgvPoint
|