- MES(B): 工单/BOM/备料/工序字典/PLC下发/拧紧/扫码报工/半成品/AGV/追溯逻辑,WMS与海康RCS客户端,看板Redis缓存API(概览/设备/进度/报警/趋势)+SSE - WMS(C): JWT滑动续签、Excel导入、盘点、内部API、种子数据、独立Postgres配置 - WMS客户端(E): Go网关8891反向代理+内嵌Vue3十页 - 工位终端(D): SQLite本地缓存+模拟拧紧源+内嵌Vue3页面 - Dashboard(A): 看板数据改接MES内部缓存API,SSE实时刷新+vite代理 - 清理各项目球形磨遗留代码,新增部署手册.md
1224 lines
36 KiB
Go
1224 lines
36 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_wms/ent/inboundorder"
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// InboundOrderCreate is the builder for creating a InboundOrder entity.
|
|
type InboundOrderCreate struct {
|
|
config
|
|
mutation *InboundOrderMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetInboundNo sets the "inbound_no" field.
|
|
func (_c *InboundOrderCreate) SetInboundNo(v string) *InboundOrderCreate {
|
|
_c.mutation.SetInboundNo(v)
|
|
return _c
|
|
}
|
|
|
|
// SetInboundType sets the "inbound_type" field.
|
|
func (_c *InboundOrderCreate) SetInboundType(v string) *InboundOrderCreate {
|
|
_c.mutation.SetInboundType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableInboundType sets the "inbound_type" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableInboundType(v *string) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetInboundType(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (_c *InboundOrderCreate) SetMaterialCode(v string) *InboundOrderCreate {
|
|
_c.mutation.SetMaterialCode(v)
|
|
return _c
|
|
}
|
|
|
|
// SetMaterialName sets the "material_name" field.
|
|
func (_c *InboundOrderCreate) SetMaterialName(v string) *InboundOrderCreate {
|
|
_c.mutation.SetMaterialName(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableMaterialName sets the "material_name" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableMaterialName(v *string) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetMaterialName(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetManageMode sets the "manage_mode" field.
|
|
func (_c *InboundOrderCreate) SetManageMode(v int) *InboundOrderCreate {
|
|
_c.mutation.SetManageMode(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableManageMode sets the "manage_mode" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableManageMode(v *int) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetManageMode(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetBatchNo sets the "batch_no" field.
|
|
func (_c *InboundOrderCreate) SetBatchNo(v string) *InboundOrderCreate {
|
|
_c.mutation.SetBatchNo(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableBatchNo(v *string) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetBatchNo(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (_c *InboundOrderCreate) SetZoneCode(v string) *InboundOrderCreate {
|
|
_c.mutation.SetZoneCode(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableZoneCode(v *string) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetZoneCode(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (_c *InboundOrderCreate) SetQuantity(v int) *InboundOrderCreate {
|
|
_c.mutation.SetQuantity(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableQuantity(v *int) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetQuantity(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetOperator sets the "operator" field.
|
|
func (_c *InboundOrderCreate) SetOperator(v string) *InboundOrderCreate {
|
|
_c.mutation.SetOperator(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableOperator sets the "operator" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableOperator(v *string) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetOperator(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetRemark sets the "remark" field.
|
|
func (_c *InboundOrderCreate) SetRemark(v string) *InboundOrderCreate {
|
|
_c.mutation.SetRemark(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableRemark(v *string) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetRemark(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *InboundOrderCreate) SetCreatedAt(v int64) *InboundOrderCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *InboundOrderCreate) SetNillableCreatedAt(v *int64) *InboundOrderCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// Mutation returns the InboundOrderMutation object of the builder.
|
|
func (_c *InboundOrderCreate) Mutation() *InboundOrderMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the InboundOrder in the database.
|
|
func (_c *InboundOrderCreate) Save(ctx context.Context) (*InboundOrder, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *InboundOrderCreate) SaveX(ctx context.Context) *InboundOrder {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *InboundOrderCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *InboundOrderCreate) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_c *InboundOrderCreate) defaults() {
|
|
if _, ok := _c.mutation.InboundType(); !ok {
|
|
v := inboundorder.DefaultInboundType
|
|
_c.mutation.SetInboundType(v)
|
|
}
|
|
if _, ok := _c.mutation.ManageMode(); !ok {
|
|
v := inboundorder.DefaultManageMode
|
|
_c.mutation.SetManageMode(v)
|
|
}
|
|
if _, ok := _c.mutation.Quantity(); !ok {
|
|
v := inboundorder.DefaultQuantity
|
|
_c.mutation.SetQuantity(v)
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := inboundorder.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *InboundOrderCreate) check() error {
|
|
if _, ok := _c.mutation.InboundNo(); !ok {
|
|
return &ValidationError{Name: "inbound_no", err: errors.New(`ent: missing required field "InboundOrder.inbound_no"`)}
|
|
}
|
|
if _, ok := _c.mutation.InboundType(); !ok {
|
|
return &ValidationError{Name: "inbound_type", err: errors.New(`ent: missing required field "InboundOrder.inbound_type"`)}
|
|
}
|
|
if _, ok := _c.mutation.MaterialCode(); !ok {
|
|
return &ValidationError{Name: "material_code", err: errors.New(`ent: missing required field "InboundOrder.material_code"`)}
|
|
}
|
|
if _, ok := _c.mutation.ManageMode(); !ok {
|
|
return &ValidationError{Name: "manage_mode", err: errors.New(`ent: missing required field "InboundOrder.manage_mode"`)}
|
|
}
|
|
if _, ok := _c.mutation.Quantity(); !ok {
|
|
return &ValidationError{Name: "quantity", err: errors.New(`ent: missing required field "InboundOrder.quantity"`)}
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "InboundOrder.created_at"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *InboundOrderCreate) sqlSave(ctx context.Context) (*InboundOrder, error) {
|
|
if err := _c.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
_node, _spec := _c.createSpec()
|
|
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
id := _spec.ID.Value.(int64)
|
|
_node.ID = int(id)
|
|
_c.mutation.id = &_node.ID
|
|
_c.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (_c *InboundOrderCreate) createSpec() (*InboundOrder, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &InboundOrder{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(inboundorder.Table, sqlgraph.NewFieldSpec(inboundorder.FieldID, field.TypeInt))
|
|
)
|
|
_spec.OnConflict = _c.conflict
|
|
if value, ok := _c.mutation.InboundNo(); ok {
|
|
_spec.SetField(inboundorder.FieldInboundNo, field.TypeString, value)
|
|
_node.InboundNo = value
|
|
}
|
|
if value, ok := _c.mutation.InboundType(); ok {
|
|
_spec.SetField(inboundorder.FieldInboundType, field.TypeString, value)
|
|
_node.InboundType = value
|
|
}
|
|
if value, ok := _c.mutation.MaterialCode(); ok {
|
|
_spec.SetField(inboundorder.FieldMaterialCode, field.TypeString, value)
|
|
_node.MaterialCode = value
|
|
}
|
|
if value, ok := _c.mutation.MaterialName(); ok {
|
|
_spec.SetField(inboundorder.FieldMaterialName, field.TypeString, value)
|
|
_node.MaterialName = value
|
|
}
|
|
if value, ok := _c.mutation.ManageMode(); ok {
|
|
_spec.SetField(inboundorder.FieldManageMode, field.TypeInt, value)
|
|
_node.ManageMode = value
|
|
}
|
|
if value, ok := _c.mutation.BatchNo(); ok {
|
|
_spec.SetField(inboundorder.FieldBatchNo, field.TypeString, value)
|
|
_node.BatchNo = value
|
|
}
|
|
if value, ok := _c.mutation.ZoneCode(); ok {
|
|
_spec.SetField(inboundorder.FieldZoneCode, field.TypeString, value)
|
|
_node.ZoneCode = value
|
|
}
|
|
if value, ok := _c.mutation.Quantity(); ok {
|
|
_spec.SetField(inboundorder.FieldQuantity, field.TypeInt, value)
|
|
_node.Quantity = value
|
|
}
|
|
if value, ok := _c.mutation.Operator(); ok {
|
|
_spec.SetField(inboundorder.FieldOperator, field.TypeString, value)
|
|
_node.Operator = value
|
|
}
|
|
if value, ok := _c.mutation.Remark(); ok {
|
|
_spec.SetField(inboundorder.FieldRemark, field.TypeString, value)
|
|
_node.Remark = value
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
return _node, _spec
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// SetInboundNo(v).
|
|
// OnConflict(
|
|
// // Update the row with the new values
|
|
// // the was proposed for insertion.
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// // Override some of the fields with custom
|
|
// // update values.
|
|
// Update(func(u *ent.InboundOrderUpsert) {
|
|
// SetInboundNo(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *InboundOrderCreate) OnConflict(opts ...sql.ConflictOption) *InboundOrderUpsertOne {
|
|
_c.conflict = opts
|
|
return &InboundOrderUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *InboundOrderCreate) OnConflictColumns(columns ...string) *InboundOrderUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &InboundOrderUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// InboundOrderUpsertOne is the builder for "upsert"-ing
|
|
// one InboundOrder node.
|
|
InboundOrderUpsertOne struct {
|
|
create *InboundOrderCreate
|
|
}
|
|
|
|
// InboundOrderUpsert is the "OnConflict" setter.
|
|
InboundOrderUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetInboundNo sets the "inbound_no" field.
|
|
func (u *InboundOrderUpsert) SetInboundNo(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldInboundNo, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateInboundNo sets the "inbound_no" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateInboundNo() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldInboundNo)
|
|
return u
|
|
}
|
|
|
|
// SetInboundType sets the "inbound_type" field.
|
|
func (u *InboundOrderUpsert) SetInboundType(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldInboundType, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateInboundType sets the "inbound_type" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateInboundType() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldInboundType)
|
|
return u
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (u *InboundOrderUpsert) SetMaterialCode(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldMaterialCode, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateMaterialCode sets the "material_code" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateMaterialCode() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldMaterialCode)
|
|
return u
|
|
}
|
|
|
|
// SetMaterialName sets the "material_name" field.
|
|
func (u *InboundOrderUpsert) SetMaterialName(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldMaterialName, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateMaterialName sets the "material_name" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateMaterialName() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldMaterialName)
|
|
return u
|
|
}
|
|
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
|
func (u *InboundOrderUpsert) ClearMaterialName() *InboundOrderUpsert {
|
|
u.SetNull(inboundorder.FieldMaterialName)
|
|
return u
|
|
}
|
|
|
|
// SetManageMode sets the "manage_mode" field.
|
|
func (u *InboundOrderUpsert) SetManageMode(v int) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldManageMode, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateManageMode sets the "manage_mode" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateManageMode() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldManageMode)
|
|
return u
|
|
}
|
|
|
|
// AddManageMode adds v to the "manage_mode" field.
|
|
func (u *InboundOrderUpsert) AddManageMode(v int) *InboundOrderUpsert {
|
|
u.Add(inboundorder.FieldManageMode, v)
|
|
return u
|
|
}
|
|
|
|
// SetBatchNo sets the "batch_no" field.
|
|
func (u *InboundOrderUpsert) SetBatchNo(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldBatchNo, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateBatchNo() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldBatchNo)
|
|
return u
|
|
}
|
|
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
|
func (u *InboundOrderUpsert) ClearBatchNo() *InboundOrderUpsert {
|
|
u.SetNull(inboundorder.FieldBatchNo)
|
|
return u
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (u *InboundOrderUpsert) SetZoneCode(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldZoneCode, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateZoneCode sets the "zone_code" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateZoneCode() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldZoneCode)
|
|
return u
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (u *InboundOrderUpsert) ClearZoneCode() *InboundOrderUpsert {
|
|
u.SetNull(inboundorder.FieldZoneCode)
|
|
return u
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (u *InboundOrderUpsert) SetQuantity(v int) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldQuantity, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateQuantity sets the "quantity" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateQuantity() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldQuantity)
|
|
return u
|
|
}
|
|
|
|
// AddQuantity adds v to the "quantity" field.
|
|
func (u *InboundOrderUpsert) AddQuantity(v int) *InboundOrderUpsert {
|
|
u.Add(inboundorder.FieldQuantity, v)
|
|
return u
|
|
}
|
|
|
|
// SetOperator sets the "operator" field.
|
|
func (u *InboundOrderUpsert) SetOperator(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldOperator, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateOperator sets the "operator" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateOperator() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldOperator)
|
|
return u
|
|
}
|
|
|
|
// ClearOperator clears the value of the "operator" field.
|
|
func (u *InboundOrderUpsert) ClearOperator() *InboundOrderUpsert {
|
|
u.SetNull(inboundorder.FieldOperator)
|
|
return u
|
|
}
|
|
|
|
// SetRemark sets the "remark" field.
|
|
func (u *InboundOrderUpsert) SetRemark(v string) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldRemark, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRemark sets the "remark" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateRemark() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldRemark)
|
|
return u
|
|
}
|
|
|
|
// ClearRemark clears the value of the "remark" field.
|
|
func (u *InboundOrderUpsert) ClearRemark() *InboundOrderUpsert {
|
|
u.SetNull(inboundorder.FieldRemark)
|
|
return u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *InboundOrderUpsert) SetCreatedAt(v int64) *InboundOrderUpsert {
|
|
u.Set(inboundorder.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsert) UpdateCreatedAt() *InboundOrderUpsert {
|
|
u.SetExcluded(inboundorder.FieldCreatedAt)
|
|
return u
|
|
}
|
|
|
|
// AddCreatedAt adds v to the "created_at" field.
|
|
func (u *InboundOrderUpsert) AddCreatedAt(v int64) *InboundOrderUpsert {
|
|
u.Add(inboundorder.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that were set on create.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *InboundOrderUpsertOne) UpdateNewValues() *InboundOrderUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *InboundOrderUpsertOne) Ignore() *InboundOrderUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
|
|
return u
|
|
}
|
|
|
|
// DoNothing configures the conflict_action to `DO NOTHING`.
|
|
// Supported only by SQLite and PostgreSQL.
|
|
func (u *InboundOrderUpsertOne) DoNothing() *InboundOrderUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the InboundOrderCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *InboundOrderUpsertOne) Update(set func(*InboundOrderUpsert)) *InboundOrderUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&InboundOrderUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetInboundNo sets the "inbound_no" field.
|
|
func (u *InboundOrderUpsertOne) SetInboundNo(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetInboundNo(v)
|
|
})
|
|
}
|
|
|
|
// UpdateInboundNo sets the "inbound_no" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateInboundNo() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateInboundNo()
|
|
})
|
|
}
|
|
|
|
// SetInboundType sets the "inbound_type" field.
|
|
func (u *InboundOrderUpsertOne) SetInboundType(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetInboundType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateInboundType sets the "inbound_type" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateInboundType() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateInboundType()
|
|
})
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (u *InboundOrderUpsertOne) SetMaterialCode(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetMaterialCode(v)
|
|
})
|
|
}
|
|
|
|
// UpdateMaterialCode sets the "material_code" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateMaterialCode() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateMaterialCode()
|
|
})
|
|
}
|
|
|
|
// SetMaterialName sets the "material_name" field.
|
|
func (u *InboundOrderUpsertOne) SetMaterialName(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetMaterialName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateMaterialName sets the "material_name" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateMaterialName() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateMaterialName()
|
|
})
|
|
}
|
|
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
|
func (u *InboundOrderUpsertOne) ClearMaterialName() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearMaterialName()
|
|
})
|
|
}
|
|
|
|
// SetManageMode sets the "manage_mode" field.
|
|
func (u *InboundOrderUpsertOne) SetManageMode(v int) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetManageMode(v)
|
|
})
|
|
}
|
|
|
|
// AddManageMode adds v to the "manage_mode" field.
|
|
func (u *InboundOrderUpsertOne) AddManageMode(v int) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.AddManageMode(v)
|
|
})
|
|
}
|
|
|
|
// UpdateManageMode sets the "manage_mode" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateManageMode() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateManageMode()
|
|
})
|
|
}
|
|
|
|
// SetBatchNo sets the "batch_no" field.
|
|
func (u *InboundOrderUpsertOne) SetBatchNo(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetBatchNo(v)
|
|
})
|
|
}
|
|
|
|
// UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateBatchNo() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateBatchNo()
|
|
})
|
|
}
|
|
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
|
func (u *InboundOrderUpsertOne) ClearBatchNo() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearBatchNo()
|
|
})
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (u *InboundOrderUpsertOne) SetZoneCode(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetZoneCode(v)
|
|
})
|
|
}
|
|
|
|
// UpdateZoneCode sets the "zone_code" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateZoneCode() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateZoneCode()
|
|
})
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (u *InboundOrderUpsertOne) ClearZoneCode() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearZoneCode()
|
|
})
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (u *InboundOrderUpsertOne) SetQuantity(v int) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetQuantity(v)
|
|
})
|
|
}
|
|
|
|
// AddQuantity adds v to the "quantity" field.
|
|
func (u *InboundOrderUpsertOne) AddQuantity(v int) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.AddQuantity(v)
|
|
})
|
|
}
|
|
|
|
// UpdateQuantity sets the "quantity" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateQuantity() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateQuantity()
|
|
})
|
|
}
|
|
|
|
// SetOperator sets the "operator" field.
|
|
func (u *InboundOrderUpsertOne) SetOperator(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetOperator(v)
|
|
})
|
|
}
|
|
|
|
// UpdateOperator sets the "operator" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateOperator() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateOperator()
|
|
})
|
|
}
|
|
|
|
// ClearOperator clears the value of the "operator" field.
|
|
func (u *InboundOrderUpsertOne) ClearOperator() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearOperator()
|
|
})
|
|
}
|
|
|
|
// SetRemark sets the "remark" field.
|
|
func (u *InboundOrderUpsertOne) SetRemark(v string) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetRemark(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRemark sets the "remark" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateRemark() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateRemark()
|
|
})
|
|
}
|
|
|
|
// ClearRemark clears the value of the "remark" field.
|
|
func (u *InboundOrderUpsertOne) ClearRemark() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearRemark()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *InboundOrderUpsertOne) SetCreatedAt(v int64) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// AddCreatedAt adds v to the "created_at" field.
|
|
func (u *InboundOrderUpsertOne) AddCreatedAt(v int64) *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.AddCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertOne) UpdateCreatedAt() *InboundOrderUpsertOne {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *InboundOrderUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for InboundOrderCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *InboundOrderUpsertOne) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// Exec executes the UPSERT query and returns the inserted/updated ID.
|
|
func (u *InboundOrderUpsertOne) ID(ctx context.Context) (id int, err error) {
|
|
node, err := u.create.Save(ctx)
|
|
if err != nil {
|
|
return id, err
|
|
}
|
|
return node.ID, nil
|
|
}
|
|
|
|
// IDX is like ID, but panics if an error occurs.
|
|
func (u *InboundOrderUpsertOne) IDX(ctx context.Context) int {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// InboundOrderCreateBulk is the builder for creating many InboundOrder entities in bulk.
|
|
type InboundOrderCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*InboundOrderCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the InboundOrder entities in the database.
|
|
func (_c *InboundOrderCreateBulk) Save(ctx context.Context) ([]*InboundOrder, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*InboundOrder, len(_c.builders))
|
|
mutators := make([]Mutator, len(_c.builders))
|
|
for i := range _c.builders {
|
|
func(i int, root context.Context) {
|
|
builder := _c.builders[i]
|
|
builder.defaults()
|
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
|
mutation, ok := m.(*InboundOrderMutation)
|
|
if !ok {
|
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
|
}
|
|
if err := builder.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
builder.mutation = mutation
|
|
var err error
|
|
nodes[i], specs[i] = builder.createSpec()
|
|
if i < len(mutators)-1 {
|
|
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
|
|
} else {
|
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
|
spec.OnConflict = _c.conflict
|
|
// Invoke the actual operation on the latest mutation in the chain.
|
|
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
}
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
mutation.id = &nodes[i].ID
|
|
if specs[i].ID.Value != nil {
|
|
id := specs[i].ID.Value.(int64)
|
|
nodes[i].ID = int(id)
|
|
}
|
|
mutation.done = true
|
|
return nodes[i], nil
|
|
})
|
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
|
mut = builder.hooks[i](mut)
|
|
}
|
|
mutators[i] = mut
|
|
}(i, ctx)
|
|
}
|
|
if len(mutators) > 0 {
|
|
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return nodes, nil
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_c *InboundOrderCreateBulk) SaveX(ctx context.Context) []*InboundOrder {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *InboundOrderCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *InboundOrderCreateBulk) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.InboundOrder.CreateBulk(builders...).
|
|
// OnConflict(
|
|
// // Update the row with the new values
|
|
// // the was proposed for insertion.
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// // Override some of the fields with custom
|
|
// // update values.
|
|
// Update(func(u *ent.InboundOrderUpsert) {
|
|
// SetInboundNo(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *InboundOrderCreateBulk) OnConflict(opts ...sql.ConflictOption) *InboundOrderUpsertBulk {
|
|
_c.conflict = opts
|
|
return &InboundOrderUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *InboundOrderCreateBulk) OnConflictColumns(columns ...string) *InboundOrderUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &InboundOrderUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// InboundOrderUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of InboundOrder nodes.
|
|
type InboundOrderUpsertBulk struct {
|
|
create *InboundOrderCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *InboundOrderUpsertBulk) UpdateNewValues() *InboundOrderUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.InboundOrder.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *InboundOrderUpsertBulk) Ignore() *InboundOrderUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
|
|
return u
|
|
}
|
|
|
|
// DoNothing configures the conflict_action to `DO NOTHING`.
|
|
// Supported only by SQLite and PostgreSQL.
|
|
func (u *InboundOrderUpsertBulk) DoNothing() *InboundOrderUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the InboundOrderCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *InboundOrderUpsertBulk) Update(set func(*InboundOrderUpsert)) *InboundOrderUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&InboundOrderUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetInboundNo sets the "inbound_no" field.
|
|
func (u *InboundOrderUpsertBulk) SetInboundNo(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetInboundNo(v)
|
|
})
|
|
}
|
|
|
|
// UpdateInboundNo sets the "inbound_no" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateInboundNo() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateInboundNo()
|
|
})
|
|
}
|
|
|
|
// SetInboundType sets the "inbound_type" field.
|
|
func (u *InboundOrderUpsertBulk) SetInboundType(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetInboundType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateInboundType sets the "inbound_type" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateInboundType() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateInboundType()
|
|
})
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (u *InboundOrderUpsertBulk) SetMaterialCode(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetMaterialCode(v)
|
|
})
|
|
}
|
|
|
|
// UpdateMaterialCode sets the "material_code" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateMaterialCode() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateMaterialCode()
|
|
})
|
|
}
|
|
|
|
// SetMaterialName sets the "material_name" field.
|
|
func (u *InboundOrderUpsertBulk) SetMaterialName(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetMaterialName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateMaterialName sets the "material_name" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateMaterialName() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateMaterialName()
|
|
})
|
|
}
|
|
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
|
func (u *InboundOrderUpsertBulk) ClearMaterialName() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearMaterialName()
|
|
})
|
|
}
|
|
|
|
// SetManageMode sets the "manage_mode" field.
|
|
func (u *InboundOrderUpsertBulk) SetManageMode(v int) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetManageMode(v)
|
|
})
|
|
}
|
|
|
|
// AddManageMode adds v to the "manage_mode" field.
|
|
func (u *InboundOrderUpsertBulk) AddManageMode(v int) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.AddManageMode(v)
|
|
})
|
|
}
|
|
|
|
// UpdateManageMode sets the "manage_mode" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateManageMode() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateManageMode()
|
|
})
|
|
}
|
|
|
|
// SetBatchNo sets the "batch_no" field.
|
|
func (u *InboundOrderUpsertBulk) SetBatchNo(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetBatchNo(v)
|
|
})
|
|
}
|
|
|
|
// UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateBatchNo() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateBatchNo()
|
|
})
|
|
}
|
|
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
|
func (u *InboundOrderUpsertBulk) ClearBatchNo() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearBatchNo()
|
|
})
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (u *InboundOrderUpsertBulk) SetZoneCode(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetZoneCode(v)
|
|
})
|
|
}
|
|
|
|
// UpdateZoneCode sets the "zone_code" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateZoneCode() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateZoneCode()
|
|
})
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (u *InboundOrderUpsertBulk) ClearZoneCode() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearZoneCode()
|
|
})
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (u *InboundOrderUpsertBulk) SetQuantity(v int) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetQuantity(v)
|
|
})
|
|
}
|
|
|
|
// AddQuantity adds v to the "quantity" field.
|
|
func (u *InboundOrderUpsertBulk) AddQuantity(v int) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.AddQuantity(v)
|
|
})
|
|
}
|
|
|
|
// UpdateQuantity sets the "quantity" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateQuantity() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateQuantity()
|
|
})
|
|
}
|
|
|
|
// SetOperator sets the "operator" field.
|
|
func (u *InboundOrderUpsertBulk) SetOperator(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetOperator(v)
|
|
})
|
|
}
|
|
|
|
// UpdateOperator sets the "operator" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateOperator() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateOperator()
|
|
})
|
|
}
|
|
|
|
// ClearOperator clears the value of the "operator" field.
|
|
func (u *InboundOrderUpsertBulk) ClearOperator() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearOperator()
|
|
})
|
|
}
|
|
|
|
// SetRemark sets the "remark" field.
|
|
func (u *InboundOrderUpsertBulk) SetRemark(v string) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetRemark(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRemark sets the "remark" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateRemark() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateRemark()
|
|
})
|
|
}
|
|
|
|
// ClearRemark clears the value of the "remark" field.
|
|
func (u *InboundOrderUpsertBulk) ClearRemark() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.ClearRemark()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *InboundOrderUpsertBulk) SetCreatedAt(v int64) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// AddCreatedAt adds v to the "created_at" field.
|
|
func (u *InboundOrderUpsertBulk) AddCreatedAt(v int64) *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.AddCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *InboundOrderUpsertBulk) UpdateCreatedAt() *InboundOrderUpsertBulk {
|
|
return u.Update(func(s *InboundOrderUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *InboundOrderUpsertBulk) Exec(ctx context.Context) error {
|
|
if u.create.err != nil {
|
|
return u.create.err
|
|
}
|
|
for i, b := range u.create.builders {
|
|
if len(b.conflict) != 0 {
|
|
return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the InboundOrderCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for InboundOrderCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *InboundOrderUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|