626 lines
18 KiB
Go
626 lines
18 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"mingyang-admin-pay/rpc/ent/paynotifylog"
|
|
"mingyang-admin-pay/rpc/ent/paynotifytask"
|
|
"mingyang-admin-pay/rpc/ent/predicate"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// PayNotifyLogUpdate is the builder for updating PayNotifyLog entities.
|
|
type PayNotifyLogUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *PayNotifyLogMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the PayNotifyLogUpdate builder.
|
|
func (_u *PayNotifyLogUpdate) Where(ps ...predicate.PayNotifyLog) *PayNotifyLogUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *PayNotifyLogUpdate) SetUpdatedAt(v time.Time) *PayNotifyLogUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *PayNotifyLogUpdate) SetStatus(v uint8) *PayNotifyLogUpdate {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdate) SetNillableStatus(v *uint8) *PayNotifyLogUpdate {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *PayNotifyLogUpdate) AddStatus(v int8) *PayNotifyLogUpdate {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *PayNotifyLogUpdate) ClearStatus() *PayNotifyLogUpdate {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *PayNotifyLogUpdate) SetDeletedAt(v time.Time) *PayNotifyLogUpdate {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdate) SetNillableDeletedAt(v *time.Time) *PayNotifyLogUpdate {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *PayNotifyLogUpdate) ClearDeletedAt() *PayNotifyLogUpdate {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (_u *PayNotifyLogUpdate) SetTaskID(v uint64) *PayNotifyLogUpdate {
|
|
_u.mutation.SetTaskID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableTaskID sets the "task_id" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdate) SetNillableTaskID(v *uint64) *PayNotifyLogUpdate {
|
|
if v != nil {
|
|
_u.SetTaskID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyCount sets the "notify_count" field.
|
|
func (_u *PayNotifyLogUpdate) SetNotifyCount(v uint32) *PayNotifyLogUpdate {
|
|
_u.mutation.ResetNotifyCount()
|
|
_u.mutation.SetNotifyCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyCount sets the "notify_count" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdate) SetNillableNotifyCount(v *uint32) *PayNotifyLogUpdate {
|
|
if v != nil {
|
|
_u.SetNotifyCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddNotifyCount adds value to the "notify_count" field.
|
|
func (_u *PayNotifyLogUpdate) AddNotifyCount(v int32) *PayNotifyLogUpdate {
|
|
_u.mutation.AddNotifyCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetResponse sets the "response" field.
|
|
func (_u *PayNotifyLogUpdate) SetResponse(v string) *PayNotifyLogUpdate {
|
|
_u.mutation.SetResponse(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableResponse sets the "response" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdate) SetNillableResponse(v *string) *PayNotifyLogUpdate {
|
|
if v != nil {
|
|
_u.SetResponse(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearResponse clears the value of the "response" field.
|
|
func (_u *PayNotifyLogUpdate) ClearResponse() *PayNotifyLogUpdate {
|
|
_u.mutation.ClearResponse()
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyStatus sets the "notify_status" field.
|
|
func (_u *PayNotifyLogUpdate) SetNotifyStatus(v string) *PayNotifyLogUpdate {
|
|
_u.mutation.SetNotifyStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyStatus sets the "notify_status" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdate) SetNillableNotifyStatus(v *string) *PayNotifyLogUpdate {
|
|
if v != nil {
|
|
_u.SetNotifyStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyStatus clears the value of the "notify_status" field.
|
|
func (_u *PayNotifyLogUpdate) ClearNotifyStatus() *PayNotifyLogUpdate {
|
|
_u.mutation.ClearNotifyStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetTask sets the "task" edge to the PayNotifyTask entity.
|
|
func (_u *PayNotifyLogUpdate) SetTask(v *PayNotifyTask) *PayNotifyLogUpdate {
|
|
return _u.SetTaskID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the PayNotifyLogMutation object of the builder.
|
|
func (_u *PayNotifyLogUpdate) Mutation() *PayNotifyLogMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearTask clears the "task" edge to the PayNotifyTask entity.
|
|
func (_u *PayNotifyLogUpdate) ClearTask() *PayNotifyLogUpdate {
|
|
_u.mutation.ClearTask()
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *PayNotifyLogUpdate) Save(ctx context.Context) (int, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *PayNotifyLogUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *PayNotifyLogUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *PayNotifyLogUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_u *PayNotifyLogUpdate) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := paynotifylog.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *PayNotifyLogUpdate) check() error {
|
|
if _u.mutation.TaskCleared() && len(_u.mutation.TaskIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayNotifyLog.task"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *PayNotifyLogUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(paynotifylog.Table, paynotifylog.Columns, sqlgraph.NewFieldSpec(paynotifylog.FieldID, field.TypeUint64))
|
|
if ps := _u.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(paynotifylog.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(paynotifylog.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(paynotifylog.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(paynotifylog.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(paynotifylog.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(paynotifylog.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.NotifyCount(); ok {
|
|
_spec.SetField(paynotifylog.FieldNotifyCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedNotifyCount(); ok {
|
|
_spec.AddField(paynotifylog.FieldNotifyCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.Response(); ok {
|
|
_spec.SetField(paynotifylog.FieldResponse, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ResponseCleared() {
|
|
_spec.ClearField(paynotifylog.FieldResponse, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.NotifyStatus(); ok {
|
|
_spec.SetField(paynotifylog.FieldNotifyStatus, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NotifyStatusCleared() {
|
|
_spec.ClearField(paynotifylog.FieldNotifyStatus, field.TypeString)
|
|
}
|
|
if _u.mutation.TaskCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifylog.TaskTable,
|
|
Columns: []string{paynotifylog.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TaskIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifylog.TaskTable,
|
|
Columns: []string{paynotifylog.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{paynotifylog.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// PayNotifyLogUpdateOne is the builder for updating a single PayNotifyLog entity.
|
|
type PayNotifyLogUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *PayNotifyLogMutation
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetUpdatedAt(v time.Time) *PayNotifyLogUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetStatus(v uint8) *PayNotifyLogUpdateOne {
|
|
_u.mutation.ResetStatus()
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdateOne) SetNillableStatus(v *uint8) *PayNotifyLogUpdateOne {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStatus adds value to the "status" field.
|
|
func (_u *PayNotifyLogUpdateOne) AddStatus(v int8) *PayNotifyLogUpdateOne {
|
|
_u.mutation.AddStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearStatus clears the value of the "status" field.
|
|
func (_u *PayNotifyLogUpdateOne) ClearStatus() *PayNotifyLogUpdateOne {
|
|
_u.mutation.ClearStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetDeletedAt sets the "deleted_at" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetDeletedAt(v time.Time) *PayNotifyLogUpdateOne {
|
|
_u.mutation.SetDeletedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdateOne) SetNillableDeletedAt(v *time.Time) *PayNotifyLogUpdateOne {
|
|
if v != nil {
|
|
_u.SetDeletedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
func (_u *PayNotifyLogUpdateOne) ClearDeletedAt() *PayNotifyLogUpdateOne {
|
|
_u.mutation.ClearDeletedAt()
|
|
return _u
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetTaskID(v uint64) *PayNotifyLogUpdateOne {
|
|
_u.mutation.SetTaskID(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableTaskID sets the "task_id" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdateOne) SetNillableTaskID(v *uint64) *PayNotifyLogUpdateOne {
|
|
if v != nil {
|
|
_u.SetTaskID(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyCount sets the "notify_count" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetNotifyCount(v uint32) *PayNotifyLogUpdateOne {
|
|
_u.mutation.ResetNotifyCount()
|
|
_u.mutation.SetNotifyCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyCount sets the "notify_count" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdateOne) SetNillableNotifyCount(v *uint32) *PayNotifyLogUpdateOne {
|
|
if v != nil {
|
|
_u.SetNotifyCount(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddNotifyCount adds value to the "notify_count" field.
|
|
func (_u *PayNotifyLogUpdateOne) AddNotifyCount(v int32) *PayNotifyLogUpdateOne {
|
|
_u.mutation.AddNotifyCount(v)
|
|
return _u
|
|
}
|
|
|
|
// SetResponse sets the "response" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetResponse(v string) *PayNotifyLogUpdateOne {
|
|
_u.mutation.SetResponse(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableResponse sets the "response" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdateOne) SetNillableResponse(v *string) *PayNotifyLogUpdateOne {
|
|
if v != nil {
|
|
_u.SetResponse(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearResponse clears the value of the "response" field.
|
|
func (_u *PayNotifyLogUpdateOne) ClearResponse() *PayNotifyLogUpdateOne {
|
|
_u.mutation.ClearResponse()
|
|
return _u
|
|
}
|
|
|
|
// SetNotifyStatus sets the "notify_status" field.
|
|
func (_u *PayNotifyLogUpdateOne) SetNotifyStatus(v string) *PayNotifyLogUpdateOne {
|
|
_u.mutation.SetNotifyStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNotifyStatus sets the "notify_status" field if the given value is not nil.
|
|
func (_u *PayNotifyLogUpdateOne) SetNillableNotifyStatus(v *string) *PayNotifyLogUpdateOne {
|
|
if v != nil {
|
|
_u.SetNotifyStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearNotifyStatus clears the value of the "notify_status" field.
|
|
func (_u *PayNotifyLogUpdateOne) ClearNotifyStatus() *PayNotifyLogUpdateOne {
|
|
_u.mutation.ClearNotifyStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetTask sets the "task" edge to the PayNotifyTask entity.
|
|
func (_u *PayNotifyLogUpdateOne) SetTask(v *PayNotifyTask) *PayNotifyLogUpdateOne {
|
|
return _u.SetTaskID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the PayNotifyLogMutation object of the builder.
|
|
func (_u *PayNotifyLogUpdateOne) Mutation() *PayNotifyLogMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// ClearTask clears the "task" edge to the PayNotifyTask entity.
|
|
func (_u *PayNotifyLogUpdateOne) ClearTask() *PayNotifyLogUpdateOne {
|
|
_u.mutation.ClearTask()
|
|
return _u
|
|
}
|
|
|
|
// Where appends a list predicates to the PayNotifyLogUpdate builder.
|
|
func (_u *PayNotifyLogUpdateOne) Where(ps ...predicate.PayNotifyLog) *PayNotifyLogUpdateOne {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
// The default is selecting all fields defined in the entity schema.
|
|
func (_u *PayNotifyLogUpdateOne) Select(field string, fields ...string) *PayNotifyLogUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated PayNotifyLog entity.
|
|
func (_u *PayNotifyLogUpdateOne) Save(ctx context.Context) (*PayNotifyLog, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *PayNotifyLogUpdateOne) SaveX(ctx context.Context) *PayNotifyLog {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *PayNotifyLogUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *PayNotifyLogUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_u *PayNotifyLogUpdateOne) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := paynotifylog.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *PayNotifyLogUpdateOne) check() error {
|
|
if _u.mutation.TaskCleared() && len(_u.mutation.TaskIDs()) > 0 {
|
|
return errors.New(`ent: clearing a required unique edge "PayNotifyLog.task"`)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_u *PayNotifyLogUpdateOne) sqlSave(ctx context.Context) (_node *PayNotifyLog, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(paynotifylog.Table, paynotifylog.Columns, sqlgraph.NewFieldSpec(paynotifylog.FieldID, field.TypeUint64))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PayNotifyLog.id" for update`)}
|
|
}
|
|
_spec.Node.ID.Value = id
|
|
if fields := _u.fields; len(fields) > 0 {
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
_spec.Node.Columns = append(_spec.Node.Columns, paynotifylog.FieldID)
|
|
for _, f := range fields {
|
|
if !paynotifylog.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != paynotifylog.FieldID {
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
}
|
|
}
|
|
}
|
|
if ps := _u.mutation.predicates; len(ps) > 0 {
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
for i := range ps {
|
|
ps[i](selector)
|
|
}
|
|
}
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(paynotifylog.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(paynotifylog.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStatus(); ok {
|
|
_spec.AddField(paynotifylog.FieldStatus, field.TypeUint8, value)
|
|
}
|
|
if _u.mutation.StatusCleared() {
|
|
_spec.ClearField(paynotifylog.FieldStatus, field.TypeUint8)
|
|
}
|
|
if value, ok := _u.mutation.DeletedAt(); ok {
|
|
_spec.SetField(paynotifylog.FieldDeletedAt, field.TypeTime, value)
|
|
}
|
|
if _u.mutation.DeletedAtCleared() {
|
|
_spec.ClearField(paynotifylog.FieldDeletedAt, field.TypeTime)
|
|
}
|
|
if value, ok := _u.mutation.NotifyCount(); ok {
|
|
_spec.SetField(paynotifylog.FieldNotifyCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedNotifyCount(); ok {
|
|
_spec.AddField(paynotifylog.FieldNotifyCount, field.TypeUint32, value)
|
|
}
|
|
if value, ok := _u.mutation.Response(); ok {
|
|
_spec.SetField(paynotifylog.FieldResponse, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ResponseCleared() {
|
|
_spec.ClearField(paynotifylog.FieldResponse, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.NotifyStatus(); ok {
|
|
_spec.SetField(paynotifylog.FieldNotifyStatus, field.TypeString, value)
|
|
}
|
|
if _u.mutation.NotifyStatusCleared() {
|
|
_spec.ClearField(paynotifylog.FieldNotifyStatus, field.TypeString)
|
|
}
|
|
if _u.mutation.TaskCleared() {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifylog.TaskTable,
|
|
Columns: []string{paynotifylog.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
}
|
|
if nodes := _u.mutation.TaskIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: paynotifylog.TaskTable,
|
|
Columns: []string{paynotifylog.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
}
|
|
_node = &PayNotifyLog{config: _u.config}
|
|
_spec.Assign = _node.assignValues
|
|
_spec.ScanValues = _node.scanValues
|
|
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{paynotifylog.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|