mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: skip checking required fields with db-based default values (#3204)
This commit is contained in:
@@ -32,6 +32,19 @@ func (bu *BlogUpdate) Where(ps ...predicate.Blog) *BlogUpdate {
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetOid sets the "oid" field.
|
||||
func (bu *BlogUpdate) SetOid(i int) *BlogUpdate {
|
||||
bu.mutation.ResetOid()
|
||||
bu.mutation.SetOid(i)
|
||||
return bu
|
||||
}
|
||||
|
||||
// AddOid adds i to the "oid" field.
|
||||
func (bu *BlogUpdate) AddOid(i int) *BlogUpdate {
|
||||
bu.mutation.AddOid(i)
|
||||
return bu
|
||||
}
|
||||
|
||||
// AddAdminIDs adds the "admins" edge to the User entity by IDs.
|
||||
func (bu *BlogUpdate) AddAdminIDs(ids ...int) *BlogUpdate {
|
||||
bu.mutation.AddAdminIDs(ids...)
|
||||
@@ -118,6 +131,12 @@ func (bu *BlogUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := bu.mutation.Oid(); ok {
|
||||
_spec.SetField(blog.FieldOid, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := bu.mutation.AddedOid(); ok {
|
||||
_spec.AddField(blog.FieldOid, field.TypeInt, value)
|
||||
}
|
||||
if bu.mutation.AdminsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
@@ -192,6 +211,19 @@ type BlogUpdateOne struct {
|
||||
mutation *BlogMutation
|
||||
}
|
||||
|
||||
// SetOid sets the "oid" field.
|
||||
func (buo *BlogUpdateOne) SetOid(i int) *BlogUpdateOne {
|
||||
buo.mutation.ResetOid()
|
||||
buo.mutation.SetOid(i)
|
||||
return buo
|
||||
}
|
||||
|
||||
// AddOid adds i to the "oid" field.
|
||||
func (buo *BlogUpdateOne) AddOid(i int) *BlogUpdateOne {
|
||||
buo.mutation.AddOid(i)
|
||||
return buo
|
||||
}
|
||||
|
||||
// AddAdminIDs adds the "admins" edge to the User entity by IDs.
|
||||
func (buo *BlogUpdateOne) AddAdminIDs(ids ...int) *BlogUpdateOne {
|
||||
buo.mutation.AddAdminIDs(ids...)
|
||||
@@ -302,6 +334,12 @@ func (buo *BlogUpdateOne) sqlSave(ctx context.Context) (_node *Blog, err error)
|
||||
}
|
||||
}
|
||||
}
|
||||
if value, ok := buo.mutation.Oid(); ok {
|
||||
_spec.SetField(blog.FieldOid, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := buo.mutation.AddedOid(); ok {
|
||||
_spec.AddField(blog.FieldOid, field.TypeInt, value)
|
||||
}
|
||||
if buo.mutation.AdminsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
|
||||
Reference in New Issue
Block a user