|
|
@ -6,6 +6,7 @@ import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
|
@ -23,6 +24,34 @@ type DictionaryDetailCreate struct {
|
|
|
|
conflict []sql.ConflictOption
|
|
|
|
conflict []sql.ConflictOption
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
|
|
|
|
|
|
func (ddc *DictionaryDetailCreate) SetCreatedAt(t time.Time) *DictionaryDetailCreate {
|
|
|
|
|
|
|
|
ddc.mutation.SetCreatedAt(t)
|
|
|
|
|
|
|
|
return ddc
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
|
|
|
|
|
|
func (ddc *DictionaryDetailCreate) SetNillableCreatedAt(t *time.Time) *DictionaryDetailCreate {
|
|
|
|
|
|
|
|
if t != nil {
|
|
|
|
|
|
|
|
ddc.SetCreatedAt(*t)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ddc
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
|
|
|
|
|
|
func (ddc *DictionaryDetailCreate) SetUpdatedAt(t time.Time) *DictionaryDetailCreate {
|
|
|
|
|
|
|
|
ddc.mutation.SetUpdatedAt(t)
|
|
|
|
|
|
|
|
return ddc
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
|
|
|
|
|
|
func (ddc *DictionaryDetailCreate) SetNillableUpdatedAt(t *time.Time) *DictionaryDetailCreate {
|
|
|
|
|
|
|
|
if t != nil {
|
|
|
|
|
|
|
|
ddc.SetUpdatedAt(*t)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ddc
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
func (ddc *DictionaryDetailCreate) SetStatus(t types.Status) *DictionaryDetailCreate {
|
|
|
|
func (ddc *DictionaryDetailCreate) SetStatus(t types.Status) *DictionaryDetailCreate {
|
|
|
|
ddc.mutation.SetStatus(t)
|
|
|
|
ddc.mutation.SetStatus(t)
|
|
|
@ -145,6 +174,20 @@ func (ddc *DictionaryDetailCreate) ExecX(ctx context.Context) {
|
|
|
|
|
|
|
|
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
|
|
func (ddc *DictionaryDetailCreate) defaults() error {
|
|
|
|
func (ddc *DictionaryDetailCreate) defaults() error {
|
|
|
|
|
|
|
|
if _, ok := ddc.mutation.CreatedAt(); !ok {
|
|
|
|
|
|
|
|
if dictionarydetail.DefaultCreatedAt == nil {
|
|
|
|
|
|
|
|
return fmt.Errorf("ent: uninitialized dictionarydetail.DefaultCreatedAt (forgotten import ent/runtime?)")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
v := dictionarydetail.DefaultCreatedAt()
|
|
|
|
|
|
|
|
ddc.mutation.SetCreatedAt(v)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := ddc.mutation.UpdatedAt(); !ok {
|
|
|
|
|
|
|
|
if dictionarydetail.DefaultUpdatedAt == nil {
|
|
|
|
|
|
|
|
return fmt.Errorf("ent: uninitialized dictionarydetail.DefaultUpdatedAt (forgotten import ent/runtime?)")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
v := dictionarydetail.DefaultUpdatedAt()
|
|
|
|
|
|
|
|
ddc.mutation.SetUpdatedAt(v)
|
|
|
|
|
|
|
|
}
|
|
|
|
if _, ok := ddc.mutation.Status(); !ok {
|
|
|
|
if _, ok := ddc.mutation.Status(); !ok {
|
|
|
|
v := dictionarydetail.DefaultStatus
|
|
|
|
v := dictionarydetail.DefaultStatus
|
|
|
|
ddc.mutation.SetStatus(v)
|
|
|
|
ddc.mutation.SetStatus(v)
|
|
|
@ -169,6 +212,12 @@ func (ddc *DictionaryDetailCreate) defaults() error {
|
|
|
|
|
|
|
|
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
|
|
func (ddc *DictionaryDetailCreate) check() error {
|
|
|
|
func (ddc *DictionaryDetailCreate) check() error {
|
|
|
|
|
|
|
|
if _, ok := ddc.mutation.CreatedAt(); !ok {
|
|
|
|
|
|
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "DictionaryDetail.created_at"`)}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := ddc.mutation.UpdatedAt(); !ok {
|
|
|
|
|
|
|
|
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "DictionaryDetail.updated_at"`)}
|
|
|
|
|
|
|
|
}
|
|
|
|
if _, ok := ddc.mutation.Status(); !ok {
|
|
|
|
if _, ok := ddc.mutation.Status(); !ok {
|
|
|
|
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "DictionaryDetail.status"`)}
|
|
|
|
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "DictionaryDetail.status"`)}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -231,6 +280,14 @@ func (ddc *DictionaryDetailCreate) createSpec() (*DictionaryDetail, *sqlgraph.Cr
|
|
|
|
_node.ID = id
|
|
|
|
_node.ID = id
|
|
|
|
_spec.ID.Value = id
|
|
|
|
_spec.ID.Value = id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if value, ok := ddc.mutation.CreatedAt(); ok {
|
|
|
|
|
|
|
|
_spec.SetField(dictionarydetail.FieldCreatedAt, field.TypeTime, value)
|
|
|
|
|
|
|
|
_node.CreatedAt = value
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if value, ok := ddc.mutation.UpdatedAt(); ok {
|
|
|
|
|
|
|
|
_spec.SetField(dictionarydetail.FieldUpdatedAt, field.TypeTime, value)
|
|
|
|
|
|
|
|
_node.UpdatedAt = value
|
|
|
|
|
|
|
|
}
|
|
|
|
if value, ok := ddc.mutation.Status(); ok {
|
|
|
|
if value, ok := ddc.mutation.Status(); ok {
|
|
|
|
_spec.SetField(dictionarydetail.FieldStatus, field.TypeEnum, value)
|
|
|
|
_spec.SetField(dictionarydetail.FieldStatus, field.TypeEnum, value)
|
|
|
|
_node.Status = value
|
|
|
|
_node.Status = value
|
|
|
@ -279,7 +336,7 @@ func (ddc *DictionaryDetailCreate) createSpec() (*DictionaryDetail, *sqlgraph.Cr
|
|
|
|
// of the `INSERT` statement. For example:
|
|
|
|
// of the `INSERT` statement. For example:
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// client.DictionaryDetail.Create().
|
|
|
|
// client.DictionaryDetail.Create().
|
|
|
|
// SetStatus(v).
|
|
|
|
// SetCreatedAt(v).
|
|
|
|
// OnConflict(
|
|
|
|
// OnConflict(
|
|
|
|
// // Update the row with the new values
|
|
|
|
// // Update the row with the new values
|
|
|
|
// // the was proposed for insertion.
|
|
|
|
// // the was proposed for insertion.
|
|
|
@ -288,7 +345,7 @@ func (ddc *DictionaryDetailCreate) createSpec() (*DictionaryDetail, *sqlgraph.Cr
|
|
|
|
// // Override some of the fields with custom
|
|
|
|
// // Override some of the fields with custom
|
|
|
|
// // update values.
|
|
|
|
// // update values.
|
|
|
|
// Update(func(u *ent.DictionaryDetailUpsert) {
|
|
|
|
// Update(func(u *ent.DictionaryDetailUpsert) {
|
|
|
|
// SetStatus(v+v).
|
|
|
|
// SetCreatedAt(v+v).
|
|
|
|
// }).
|
|
|
|
// }).
|
|
|
|
// Exec(ctx)
|
|
|
|
// Exec(ctx)
|
|
|
|
func (ddc *DictionaryDetailCreate) OnConflict(opts ...sql.ConflictOption) *DictionaryDetailUpsertOne {
|
|
|
|
func (ddc *DictionaryDetailCreate) OnConflict(opts ...sql.ConflictOption) *DictionaryDetailUpsertOne {
|
|
|
@ -324,6 +381,18 @@ type (
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
|
|
|
|
|
|
func (u *DictionaryDetailUpsert) SetUpdatedAt(v time.Time) *DictionaryDetailUpsert {
|
|
|
|
|
|
|
|
u.Set(dictionarydetail.FieldUpdatedAt, v)
|
|
|
|
|
|
|
|
return u
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
|
|
|
|
|
|
func (u *DictionaryDetailUpsert) UpdateUpdatedAt() *DictionaryDetailUpsert {
|
|
|
|
|
|
|
|
u.SetExcluded(dictionarydetail.FieldUpdatedAt)
|
|
|
|
|
|
|
|
return u
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
func (u *DictionaryDetailUpsert) SetStatus(v types.Status) *DictionaryDetailUpsert {
|
|
|
|
func (u *DictionaryDetailUpsert) SetStatus(v types.Status) *DictionaryDetailUpsert {
|
|
|
|
u.Set(dictionarydetail.FieldStatus, v)
|
|
|
|
u.Set(dictionarydetail.FieldStatus, v)
|
|
|
@ -437,6 +506,9 @@ func (u *DictionaryDetailUpsertOne) UpdateNewValues() *DictionaryDetailUpsertOne
|
|
|
|
if _, exists := u.create.mutation.ID(); exists {
|
|
|
|
if _, exists := u.create.mutation.ID(); exists {
|
|
|
|
s.SetIgnore(dictionarydetail.FieldID)
|
|
|
|
s.SetIgnore(dictionarydetail.FieldID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, exists := u.create.mutation.CreatedAt(); exists {
|
|
|
|
|
|
|
|
s.SetIgnore(dictionarydetail.FieldCreatedAt)
|
|
|
|
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
return u
|
|
|
|
return u
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -468,6 +540,20 @@ func (u *DictionaryDetailUpsertOne) Update(set func(*DictionaryDetailUpsert)) *D
|
|
|
|
return u
|
|
|
|
return u
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
|
|
|
|
|
|
func (u *DictionaryDetailUpsertOne) SetUpdatedAt(v time.Time) *DictionaryDetailUpsertOne {
|
|
|
|
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|
|
|
|
|
s.SetUpdatedAt(v)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
|
|
|
|
|
|
func (u *DictionaryDetailUpsertOne) UpdateUpdatedAt() *DictionaryDetailUpsertOne {
|
|
|
|
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|
|
|
|
|
s.UpdateUpdatedAt()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
func (u *DictionaryDetailUpsertOne) SetStatus(v types.Status) *DictionaryDetailUpsertOne {
|
|
|
|
func (u *DictionaryDetailUpsertOne) SetStatus(v types.Status) *DictionaryDetailUpsertOne {
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
@ -711,7 +797,7 @@ func (ddcb *DictionaryDetailCreateBulk) ExecX(ctx context.Context) {
|
|
|
|
// // Override some of the fields with custom
|
|
|
|
// // Override some of the fields with custom
|
|
|
|
// // update values.
|
|
|
|
// // update values.
|
|
|
|
// Update(func(u *ent.DictionaryDetailUpsert) {
|
|
|
|
// Update(func(u *ent.DictionaryDetailUpsert) {
|
|
|
|
// SetStatus(v+v).
|
|
|
|
// SetCreatedAt(v+v).
|
|
|
|
// }).
|
|
|
|
// }).
|
|
|
|
// Exec(ctx)
|
|
|
|
// Exec(ctx)
|
|
|
|
func (ddcb *DictionaryDetailCreateBulk) OnConflict(opts ...sql.ConflictOption) *DictionaryDetailUpsertBulk {
|
|
|
|
func (ddcb *DictionaryDetailCreateBulk) OnConflict(opts ...sql.ConflictOption) *DictionaryDetailUpsertBulk {
|
|
|
@ -758,6 +844,9 @@ func (u *DictionaryDetailUpsertBulk) UpdateNewValues() *DictionaryDetailUpsertBu
|
|
|
|
if _, exists := b.mutation.ID(); exists {
|
|
|
|
if _, exists := b.mutation.ID(); exists {
|
|
|
|
s.SetIgnore(dictionarydetail.FieldID)
|
|
|
|
s.SetIgnore(dictionarydetail.FieldID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, exists := b.mutation.CreatedAt(); exists {
|
|
|
|
|
|
|
|
s.SetIgnore(dictionarydetail.FieldCreatedAt)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
return u
|
|
|
|
return u
|
|
|
@ -790,6 +879,20 @@ func (u *DictionaryDetailUpsertBulk) Update(set func(*DictionaryDetailUpsert)) *
|
|
|
|
return u
|
|
|
|
return u
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
|
|
|
|
|
|
func (u *DictionaryDetailUpsertBulk) SetUpdatedAt(v time.Time) *DictionaryDetailUpsertBulk {
|
|
|
|
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|
|
|
|
|
s.SetUpdatedAt(v)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
|
|
|
|
|
|
func (u *DictionaryDetailUpsertBulk) UpdateUpdatedAt() *DictionaryDetailUpsertBulk {
|
|
|
|
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|
|
|
|
|
s.UpdateUpdatedAt()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
// SetStatus sets the "status" field.
|
|
|
|
func (u *DictionaryDetailUpsertBulk) SetStatus(v types.Status) *DictionaryDetailUpsertBulk {
|
|
|
|
func (u *DictionaryDetailUpsertBulk) SetStatus(v types.Status) *DictionaryDetailUpsertBulk {
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|
return u.Update(func(s *DictionaryDetailUpsert) {
|
|
|
|