- 新增 SyncFailure 实体:MES/WMS 两端 schema 源 + ent 生成码(create/delete/query/update 及子包) - ent 框架文件全量重生成:client/ent/hook/migrate/mutation/predicate/runtime/tx - 清理旧代码生成入口:删除 schema/gen.go 与 schema/tools/generate.go - 同步失败页面调整:MES/WMS SyncFailure.vue 接入新实体,MES 产品工艺页同步调整 - 主程序入口注册新实体:bj_power_mes.go / bj_power_wms.go,工作站 main.go 同步调整 - 更新文档:WMS README、案例、问题记录;刷新 MES/WMS 前端构建产物
1271 lines
38 KiB
Go
1271 lines
38 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_wms/ent/syncfailure"
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// SyncFailureCreate is the builder for creating a SyncFailure entity.
|
|
type SyncFailureCreate struct {
|
|
config
|
|
mutation *SyncFailureMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetDirection sets the "direction" field.
|
|
func (_c *SyncFailureCreate) SetDirection(v string) *SyncFailureCreate {
|
|
_c.mutation.SetDirection(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableDirection sets the "direction" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableDirection(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetDirection(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetBizType sets the "biz_type" field.
|
|
func (_c *SyncFailureCreate) SetBizType(v string) *SyncFailureCreate {
|
|
_c.mutation.SetBizType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableBizType sets the "biz_type" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableBizType(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetBizType(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetBizKey sets the "biz_key" field.
|
|
func (_c *SyncFailureCreate) SetBizKey(v string) *SyncFailureCreate {
|
|
_c.mutation.SetBizKey(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableBizKey sets the "biz_key" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableBizKey(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetBizKey(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetEndpoint sets the "endpoint" field.
|
|
func (_c *SyncFailureCreate) SetEndpoint(v string) *SyncFailureCreate {
|
|
_c.mutation.SetEndpoint(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableEndpoint sets the "endpoint" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableEndpoint(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetEndpoint(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetPayloadJSON sets the "payload_json" field.
|
|
func (_c *SyncFailureCreate) SetPayloadJSON(v string) *SyncFailureCreate {
|
|
_c.mutation.SetPayloadJSON(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillablePayloadJSON sets the "payload_json" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillablePayloadJSON(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetPayloadJSON(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetErrorMsg sets the "error_msg" field.
|
|
func (_c *SyncFailureCreate) SetErrorMsg(v string) *SyncFailureCreate {
|
|
_c.mutation.SetErrorMsg(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableErrorMsg sets the "error_msg" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableErrorMsg(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetErrorMsg(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetIdempotencyKey sets the "idempotency_key" field.
|
|
func (_c *SyncFailureCreate) SetIdempotencyKey(v string) *SyncFailureCreate {
|
|
_c.mutation.SetIdempotencyKey(v)
|
|
return _c
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_c *SyncFailureCreate) SetStatus(v string) *SyncFailureCreate {
|
|
_c.mutation.SetStatus(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableStatus(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetStatus(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetRetryCount sets the "retry_count" field.
|
|
func (_c *SyncFailureCreate) SetRetryCount(v int32) *SyncFailureCreate {
|
|
_c.mutation.SetRetryCount(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableRetryCount(v *int32) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetRetryCount(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *SyncFailureCreate) SetCreatedAt(v int64) *SyncFailureCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableCreatedAt(v *int64) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetLastErrorAt sets the "last_error_at" field.
|
|
func (_c *SyncFailureCreate) SetLastErrorAt(v int64) *SyncFailureCreate {
|
|
_c.mutation.SetLastErrorAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableLastErrorAt sets the "last_error_at" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableLastErrorAt(v *int64) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetLastErrorAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetHandledBy sets the "handled_by" field.
|
|
func (_c *SyncFailureCreate) SetHandledBy(v string) *SyncFailureCreate {
|
|
_c.mutation.SetHandledBy(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableHandledBy sets the "handled_by" field if the given value is not nil.
|
|
func (_c *SyncFailureCreate) SetNillableHandledBy(v *string) *SyncFailureCreate {
|
|
if v != nil {
|
|
_c.SetHandledBy(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetID sets the "id" field.
|
|
func (_c *SyncFailureCreate) SetID(v int) *SyncFailureCreate {
|
|
_c.mutation.SetID(v)
|
|
return _c
|
|
}
|
|
|
|
// Mutation returns the SyncFailureMutation object of the builder.
|
|
func (_c *SyncFailureCreate) Mutation() *SyncFailureMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the SyncFailure in the database.
|
|
func (_c *SyncFailureCreate) Save(ctx context.Context) (*SyncFailure, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *SyncFailureCreate) SaveX(ctx context.Context) *SyncFailure {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *SyncFailureCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *SyncFailureCreate) 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 *SyncFailureCreate) defaults() {
|
|
if _, ok := _c.mutation.Direction(); !ok {
|
|
v := syncfailure.DefaultDirection
|
|
_c.mutation.SetDirection(v)
|
|
}
|
|
if _, ok := _c.mutation.BizType(); !ok {
|
|
v := syncfailure.DefaultBizType
|
|
_c.mutation.SetBizType(v)
|
|
}
|
|
if _, ok := _c.mutation.BizKey(); !ok {
|
|
v := syncfailure.DefaultBizKey
|
|
_c.mutation.SetBizKey(v)
|
|
}
|
|
if _, ok := _c.mutation.Endpoint(); !ok {
|
|
v := syncfailure.DefaultEndpoint
|
|
_c.mutation.SetEndpoint(v)
|
|
}
|
|
if _, ok := _c.mutation.PayloadJSON(); !ok {
|
|
v := syncfailure.DefaultPayloadJSON
|
|
_c.mutation.SetPayloadJSON(v)
|
|
}
|
|
if _, ok := _c.mutation.ErrorMsg(); !ok {
|
|
v := syncfailure.DefaultErrorMsg
|
|
_c.mutation.SetErrorMsg(v)
|
|
}
|
|
if _, ok := _c.mutation.Status(); !ok {
|
|
v := syncfailure.DefaultStatus
|
|
_c.mutation.SetStatus(v)
|
|
}
|
|
if _, ok := _c.mutation.RetryCount(); !ok {
|
|
v := syncfailure.DefaultRetryCount
|
|
_c.mutation.SetRetryCount(v)
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := syncfailure.DefaultCreatedAt
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.LastErrorAt(); !ok {
|
|
v := syncfailure.DefaultLastErrorAt
|
|
_c.mutation.SetLastErrorAt(v)
|
|
}
|
|
if _, ok := _c.mutation.HandledBy(); !ok {
|
|
v := syncfailure.DefaultHandledBy
|
|
_c.mutation.SetHandledBy(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *SyncFailureCreate) check() error {
|
|
if _, ok := _c.mutation.Direction(); !ok {
|
|
return &ValidationError{Name: "direction", err: errors.New(`ent: missing required field "SyncFailure.direction"`)}
|
|
}
|
|
if _, ok := _c.mutation.BizType(); !ok {
|
|
return &ValidationError{Name: "biz_type", err: errors.New(`ent: missing required field "SyncFailure.biz_type"`)}
|
|
}
|
|
if _, ok := _c.mutation.BizKey(); !ok {
|
|
return &ValidationError{Name: "biz_key", err: errors.New(`ent: missing required field "SyncFailure.biz_key"`)}
|
|
}
|
|
if _, ok := _c.mutation.Endpoint(); !ok {
|
|
return &ValidationError{Name: "endpoint", err: errors.New(`ent: missing required field "SyncFailure.endpoint"`)}
|
|
}
|
|
if _, ok := _c.mutation.PayloadJSON(); !ok {
|
|
return &ValidationError{Name: "payload_json", err: errors.New(`ent: missing required field "SyncFailure.payload_json"`)}
|
|
}
|
|
if _, ok := _c.mutation.ErrorMsg(); !ok {
|
|
return &ValidationError{Name: "error_msg", err: errors.New(`ent: missing required field "SyncFailure.error_msg"`)}
|
|
}
|
|
if _, ok := _c.mutation.IdempotencyKey(); !ok {
|
|
return &ValidationError{Name: "idempotency_key", err: errors.New(`ent: missing required field "SyncFailure.idempotency_key"`)}
|
|
}
|
|
if _, ok := _c.mutation.Status(); !ok {
|
|
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "SyncFailure.status"`)}
|
|
}
|
|
if _, ok := _c.mutation.RetryCount(); !ok {
|
|
return &ValidationError{Name: "retry_count", err: errors.New(`ent: missing required field "SyncFailure.retry_count"`)}
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "SyncFailure.created_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.LastErrorAt(); !ok {
|
|
return &ValidationError{Name: "last_error_at", err: errors.New(`ent: missing required field "SyncFailure.last_error_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.HandledBy(); !ok {
|
|
return &ValidationError{Name: "handled_by", err: errors.New(`ent: missing required field "SyncFailure.handled_by"`)}
|
|
}
|
|
if v, ok := _c.mutation.ID(); ok {
|
|
if err := syncfailure.IDValidator(v); err != nil {
|
|
return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "SyncFailure.id": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *SyncFailureCreate) sqlSave(ctx context.Context) (*SyncFailure, 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
|
|
}
|
|
if _spec.ID.Value != _node.ID {
|
|
id := _spec.ID.Value.(int64)
|
|
_node.ID = int(id)
|
|
}
|
|
_c.mutation.id = &_node.ID
|
|
_c.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (_c *SyncFailureCreate) createSpec() (*SyncFailure, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &SyncFailure{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(syncfailure.Table, sqlgraph.NewFieldSpec(syncfailure.FieldID, field.TypeInt))
|
|
)
|
|
_spec.OnConflict = _c.conflict
|
|
if id, ok := _c.mutation.ID(); ok {
|
|
_node.ID = id
|
|
_spec.ID.Value = id
|
|
}
|
|
if value, ok := _c.mutation.Direction(); ok {
|
|
_spec.SetField(syncfailure.FieldDirection, field.TypeString, value)
|
|
_node.Direction = value
|
|
}
|
|
if value, ok := _c.mutation.BizType(); ok {
|
|
_spec.SetField(syncfailure.FieldBizType, field.TypeString, value)
|
|
_node.BizType = value
|
|
}
|
|
if value, ok := _c.mutation.BizKey(); ok {
|
|
_spec.SetField(syncfailure.FieldBizKey, field.TypeString, value)
|
|
_node.BizKey = value
|
|
}
|
|
if value, ok := _c.mutation.Endpoint(); ok {
|
|
_spec.SetField(syncfailure.FieldEndpoint, field.TypeString, value)
|
|
_node.Endpoint = value
|
|
}
|
|
if value, ok := _c.mutation.PayloadJSON(); ok {
|
|
_spec.SetField(syncfailure.FieldPayloadJSON, field.TypeString, value)
|
|
_node.PayloadJSON = value
|
|
}
|
|
if value, ok := _c.mutation.ErrorMsg(); ok {
|
|
_spec.SetField(syncfailure.FieldErrorMsg, field.TypeString, value)
|
|
_node.ErrorMsg = value
|
|
}
|
|
if value, ok := _c.mutation.IdempotencyKey(); ok {
|
|
_spec.SetField(syncfailure.FieldIdempotencyKey, field.TypeString, value)
|
|
_node.IdempotencyKey = value
|
|
}
|
|
if value, ok := _c.mutation.Status(); ok {
|
|
_spec.SetField(syncfailure.FieldStatus, field.TypeString, value)
|
|
_node.Status = value
|
|
}
|
|
if value, ok := _c.mutation.RetryCount(); ok {
|
|
_spec.SetField(syncfailure.FieldRetryCount, field.TypeInt32, value)
|
|
_node.RetryCount = value
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(syncfailure.FieldCreatedAt, field.TypeInt64, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.LastErrorAt(); ok {
|
|
_spec.SetField(syncfailure.FieldLastErrorAt, field.TypeInt64, value)
|
|
_node.LastErrorAt = value
|
|
}
|
|
if value, ok := _c.mutation.HandledBy(); ok {
|
|
_spec.SetField(syncfailure.FieldHandledBy, field.TypeString, value)
|
|
_node.HandledBy = value
|
|
}
|
|
return _node, _spec
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// SetDirection(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.SyncFailureUpsert) {
|
|
// SetDirection(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *SyncFailureCreate) OnConflict(opts ...sql.ConflictOption) *SyncFailureUpsertOne {
|
|
_c.conflict = opts
|
|
return &SyncFailureUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *SyncFailureCreate) OnConflictColumns(columns ...string) *SyncFailureUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &SyncFailureUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// SyncFailureUpsertOne is the builder for "upsert"-ing
|
|
// one SyncFailure node.
|
|
SyncFailureUpsertOne struct {
|
|
create *SyncFailureCreate
|
|
}
|
|
|
|
// SyncFailureUpsert is the "OnConflict" setter.
|
|
SyncFailureUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetDirection sets the "direction" field.
|
|
func (u *SyncFailureUpsert) SetDirection(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldDirection, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateDirection sets the "direction" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateDirection() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldDirection)
|
|
return u
|
|
}
|
|
|
|
// SetBizType sets the "biz_type" field.
|
|
func (u *SyncFailureUpsert) SetBizType(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldBizType, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateBizType sets the "biz_type" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateBizType() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldBizType)
|
|
return u
|
|
}
|
|
|
|
// SetBizKey sets the "biz_key" field.
|
|
func (u *SyncFailureUpsert) SetBizKey(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldBizKey, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateBizKey sets the "biz_key" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateBizKey() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldBizKey)
|
|
return u
|
|
}
|
|
|
|
// SetEndpoint sets the "endpoint" field.
|
|
func (u *SyncFailureUpsert) SetEndpoint(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldEndpoint, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateEndpoint sets the "endpoint" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateEndpoint() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldEndpoint)
|
|
return u
|
|
}
|
|
|
|
// SetPayloadJSON sets the "payload_json" field.
|
|
func (u *SyncFailureUpsert) SetPayloadJSON(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldPayloadJSON, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePayloadJSON sets the "payload_json" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdatePayloadJSON() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldPayloadJSON)
|
|
return u
|
|
}
|
|
|
|
// SetErrorMsg sets the "error_msg" field.
|
|
func (u *SyncFailureUpsert) SetErrorMsg(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldErrorMsg, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateErrorMsg sets the "error_msg" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateErrorMsg() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldErrorMsg)
|
|
return u
|
|
}
|
|
|
|
// SetIdempotencyKey sets the "idempotency_key" field.
|
|
func (u *SyncFailureUpsert) SetIdempotencyKey(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldIdempotencyKey, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateIdempotencyKey sets the "idempotency_key" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateIdempotencyKey() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldIdempotencyKey)
|
|
return u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *SyncFailureUpsert) SetStatus(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldStatus, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateStatus() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldStatus)
|
|
return u
|
|
}
|
|
|
|
// SetRetryCount sets the "retry_count" field.
|
|
func (u *SyncFailureUpsert) SetRetryCount(v int32) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldRetryCount, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateRetryCount() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldRetryCount)
|
|
return u
|
|
}
|
|
|
|
// AddRetryCount adds v to the "retry_count" field.
|
|
func (u *SyncFailureUpsert) AddRetryCount(v int32) *SyncFailureUpsert {
|
|
u.Add(syncfailure.FieldRetryCount, v)
|
|
return u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *SyncFailureUpsert) SetCreatedAt(v int64) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateCreatedAt() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldCreatedAt)
|
|
return u
|
|
}
|
|
|
|
// AddCreatedAt adds v to the "created_at" field.
|
|
func (u *SyncFailureUpsert) AddCreatedAt(v int64) *SyncFailureUpsert {
|
|
u.Add(syncfailure.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// SetLastErrorAt sets the "last_error_at" field.
|
|
func (u *SyncFailureUpsert) SetLastErrorAt(v int64) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldLastErrorAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateLastErrorAt sets the "last_error_at" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateLastErrorAt() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldLastErrorAt)
|
|
return u
|
|
}
|
|
|
|
// AddLastErrorAt adds v to the "last_error_at" field.
|
|
func (u *SyncFailureUpsert) AddLastErrorAt(v int64) *SyncFailureUpsert {
|
|
u.Add(syncfailure.FieldLastErrorAt, v)
|
|
return u
|
|
}
|
|
|
|
// SetHandledBy sets the "handled_by" field.
|
|
func (u *SyncFailureUpsert) SetHandledBy(v string) *SyncFailureUpsert {
|
|
u.Set(syncfailure.FieldHandledBy, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateHandledBy sets the "handled_by" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsert) UpdateHandledBy() *SyncFailureUpsert {
|
|
u.SetExcluded(syncfailure.FieldHandledBy)
|
|
return u
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(syncfailure.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *SyncFailureUpsertOne) UpdateNewValues() *SyncFailureUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
|
if _, exists := u.create.mutation.ID(); exists {
|
|
s.SetIgnore(syncfailure.FieldID)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *SyncFailureUpsertOne) Ignore() *SyncFailureUpsertOne {
|
|
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 *SyncFailureUpsertOne) DoNothing() *SyncFailureUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the SyncFailureCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *SyncFailureUpsertOne) Update(set func(*SyncFailureUpsert)) *SyncFailureUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&SyncFailureUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetDirection sets the "direction" field.
|
|
func (u *SyncFailureUpsertOne) SetDirection(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetDirection(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDirection sets the "direction" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateDirection() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateDirection()
|
|
})
|
|
}
|
|
|
|
// SetBizType sets the "biz_type" field.
|
|
func (u *SyncFailureUpsertOne) SetBizType(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetBizType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateBizType sets the "biz_type" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateBizType() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateBizType()
|
|
})
|
|
}
|
|
|
|
// SetBizKey sets the "biz_key" field.
|
|
func (u *SyncFailureUpsertOne) SetBizKey(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetBizKey(v)
|
|
})
|
|
}
|
|
|
|
// UpdateBizKey sets the "biz_key" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateBizKey() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateBizKey()
|
|
})
|
|
}
|
|
|
|
// SetEndpoint sets the "endpoint" field.
|
|
func (u *SyncFailureUpsertOne) SetEndpoint(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetEndpoint(v)
|
|
})
|
|
}
|
|
|
|
// UpdateEndpoint sets the "endpoint" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateEndpoint() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateEndpoint()
|
|
})
|
|
}
|
|
|
|
// SetPayloadJSON sets the "payload_json" field.
|
|
func (u *SyncFailureUpsertOne) SetPayloadJSON(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetPayloadJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePayloadJSON sets the "payload_json" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdatePayloadJSON() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdatePayloadJSON()
|
|
})
|
|
}
|
|
|
|
// SetErrorMsg sets the "error_msg" field.
|
|
func (u *SyncFailureUpsertOne) SetErrorMsg(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetErrorMsg(v)
|
|
})
|
|
}
|
|
|
|
// UpdateErrorMsg sets the "error_msg" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateErrorMsg() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateErrorMsg()
|
|
})
|
|
}
|
|
|
|
// SetIdempotencyKey sets the "idempotency_key" field.
|
|
func (u *SyncFailureUpsertOne) SetIdempotencyKey(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetIdempotencyKey(v)
|
|
})
|
|
}
|
|
|
|
// UpdateIdempotencyKey sets the "idempotency_key" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateIdempotencyKey() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateIdempotencyKey()
|
|
})
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *SyncFailureUpsertOne) SetStatus(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetStatus(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateStatus() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateStatus()
|
|
})
|
|
}
|
|
|
|
// SetRetryCount sets the "retry_count" field.
|
|
func (u *SyncFailureUpsertOne) SetRetryCount(v int32) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetRetryCount(v)
|
|
})
|
|
}
|
|
|
|
// AddRetryCount adds v to the "retry_count" field.
|
|
func (u *SyncFailureUpsertOne) AddRetryCount(v int32) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.AddRetryCount(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateRetryCount() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateRetryCount()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *SyncFailureUpsertOne) SetCreatedAt(v int64) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// AddCreatedAt adds v to the "created_at" field.
|
|
func (u *SyncFailureUpsertOne) AddCreatedAt(v int64) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.AddCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateCreatedAt() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// SetLastErrorAt sets the "last_error_at" field.
|
|
func (u *SyncFailureUpsertOne) SetLastErrorAt(v int64) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetLastErrorAt(v)
|
|
})
|
|
}
|
|
|
|
// AddLastErrorAt adds v to the "last_error_at" field.
|
|
func (u *SyncFailureUpsertOne) AddLastErrorAt(v int64) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.AddLastErrorAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastErrorAt sets the "last_error_at" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateLastErrorAt() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateLastErrorAt()
|
|
})
|
|
}
|
|
|
|
// SetHandledBy sets the "handled_by" field.
|
|
func (u *SyncFailureUpsertOne) SetHandledBy(v string) *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetHandledBy(v)
|
|
})
|
|
}
|
|
|
|
// UpdateHandledBy sets the "handled_by" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertOne) UpdateHandledBy() *SyncFailureUpsertOne {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateHandledBy()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *SyncFailureUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for SyncFailureCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *SyncFailureUpsertOne) 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 *SyncFailureUpsertOne) 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 *SyncFailureUpsertOne) IDX(ctx context.Context) int {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// SyncFailureCreateBulk is the builder for creating many SyncFailure entities in bulk.
|
|
type SyncFailureCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*SyncFailureCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the SyncFailure entities in the database.
|
|
func (_c *SyncFailureCreateBulk) Save(ctx context.Context) ([]*SyncFailure, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*SyncFailure, 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.(*SyncFailureMutation)
|
|
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 && nodes[i].ID == 0 {
|
|
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 *SyncFailureCreateBulk) SaveX(ctx context.Context) []*SyncFailure {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *SyncFailureCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *SyncFailureCreateBulk) 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.SyncFailure.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.SyncFailureUpsert) {
|
|
// SetDirection(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *SyncFailureCreateBulk) OnConflict(opts ...sql.ConflictOption) *SyncFailureUpsertBulk {
|
|
_c.conflict = opts
|
|
return &SyncFailureUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *SyncFailureCreateBulk) OnConflictColumns(columns ...string) *SyncFailureUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &SyncFailureUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// SyncFailureUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of SyncFailure nodes.
|
|
type SyncFailureUpsertBulk struct {
|
|
create *SyncFailureCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(syncfailure.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *SyncFailureUpsertBulk) UpdateNewValues() *SyncFailureUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
|
for _, b := range u.create.builders {
|
|
if _, exists := b.mutation.ID(); exists {
|
|
s.SetIgnore(syncfailure.FieldID)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.SyncFailure.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *SyncFailureUpsertBulk) Ignore() *SyncFailureUpsertBulk {
|
|
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 *SyncFailureUpsertBulk) DoNothing() *SyncFailureUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the SyncFailureCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *SyncFailureUpsertBulk) Update(set func(*SyncFailureUpsert)) *SyncFailureUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&SyncFailureUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetDirection sets the "direction" field.
|
|
func (u *SyncFailureUpsertBulk) SetDirection(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetDirection(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDirection sets the "direction" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateDirection() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateDirection()
|
|
})
|
|
}
|
|
|
|
// SetBizType sets the "biz_type" field.
|
|
func (u *SyncFailureUpsertBulk) SetBizType(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetBizType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateBizType sets the "biz_type" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateBizType() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateBizType()
|
|
})
|
|
}
|
|
|
|
// SetBizKey sets the "biz_key" field.
|
|
func (u *SyncFailureUpsertBulk) SetBizKey(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetBizKey(v)
|
|
})
|
|
}
|
|
|
|
// UpdateBizKey sets the "biz_key" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateBizKey() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateBizKey()
|
|
})
|
|
}
|
|
|
|
// SetEndpoint sets the "endpoint" field.
|
|
func (u *SyncFailureUpsertBulk) SetEndpoint(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetEndpoint(v)
|
|
})
|
|
}
|
|
|
|
// UpdateEndpoint sets the "endpoint" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateEndpoint() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateEndpoint()
|
|
})
|
|
}
|
|
|
|
// SetPayloadJSON sets the "payload_json" field.
|
|
func (u *SyncFailureUpsertBulk) SetPayloadJSON(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetPayloadJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePayloadJSON sets the "payload_json" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdatePayloadJSON() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdatePayloadJSON()
|
|
})
|
|
}
|
|
|
|
// SetErrorMsg sets the "error_msg" field.
|
|
func (u *SyncFailureUpsertBulk) SetErrorMsg(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetErrorMsg(v)
|
|
})
|
|
}
|
|
|
|
// UpdateErrorMsg sets the "error_msg" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateErrorMsg() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateErrorMsg()
|
|
})
|
|
}
|
|
|
|
// SetIdempotencyKey sets the "idempotency_key" field.
|
|
func (u *SyncFailureUpsertBulk) SetIdempotencyKey(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetIdempotencyKey(v)
|
|
})
|
|
}
|
|
|
|
// UpdateIdempotencyKey sets the "idempotency_key" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateIdempotencyKey() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateIdempotencyKey()
|
|
})
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *SyncFailureUpsertBulk) SetStatus(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetStatus(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateStatus() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateStatus()
|
|
})
|
|
}
|
|
|
|
// SetRetryCount sets the "retry_count" field.
|
|
func (u *SyncFailureUpsertBulk) SetRetryCount(v int32) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetRetryCount(v)
|
|
})
|
|
}
|
|
|
|
// AddRetryCount adds v to the "retry_count" field.
|
|
func (u *SyncFailureUpsertBulk) AddRetryCount(v int32) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.AddRetryCount(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateRetryCount() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateRetryCount()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *SyncFailureUpsertBulk) SetCreatedAt(v int64) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// AddCreatedAt adds v to the "created_at" field.
|
|
func (u *SyncFailureUpsertBulk) AddCreatedAt(v int64) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.AddCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateCreatedAt() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// SetLastErrorAt sets the "last_error_at" field.
|
|
func (u *SyncFailureUpsertBulk) SetLastErrorAt(v int64) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetLastErrorAt(v)
|
|
})
|
|
}
|
|
|
|
// AddLastErrorAt adds v to the "last_error_at" field.
|
|
func (u *SyncFailureUpsertBulk) AddLastErrorAt(v int64) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.AddLastErrorAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastErrorAt sets the "last_error_at" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateLastErrorAt() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateLastErrorAt()
|
|
})
|
|
}
|
|
|
|
// SetHandledBy sets the "handled_by" field.
|
|
func (u *SyncFailureUpsertBulk) SetHandledBy(v string) *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.SetHandledBy(v)
|
|
})
|
|
}
|
|
|
|
// UpdateHandledBy sets the "handled_by" field to the value that was provided on create.
|
|
func (u *SyncFailureUpsertBulk) UpdateHandledBy() *SyncFailureUpsertBulk {
|
|
return u.Update(func(s *SyncFailureUpsert) {
|
|
s.UpdateHandledBy()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *SyncFailureUpsertBulk) 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 SyncFailureCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for SyncFailureCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *SyncFailureUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|