mirror of
https://github.com/ent/ent.git
synced 2026-04-28 05:30:56 +03:00
entc/gen: nillable update setters for non-optional fields (#3788)
This commit is contained in:
@@ -38,6 +38,14 @@ func (cu *CityUpdate) SetName(s string) *CityUpdate {
|
||||
return cu
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (cu *CityUpdate) SetNillableName(s *string) *CityUpdate {
|
||||
if s != nil {
|
||||
cu.SetName(*s)
|
||||
}
|
||||
return cu
|
||||
}
|
||||
|
||||
// AddStreetIDs adds the "streets" edge to the Street entity by IDs.
|
||||
func (cu *CityUpdate) AddStreetIDs(ids ...int) *CityUpdate {
|
||||
cu.mutation.AddStreetIDs(ids...)
|
||||
@@ -189,6 +197,14 @@ func (cuo *CityUpdateOne) SetName(s string) *CityUpdateOne {
|
||||
return cuo
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (cuo *CityUpdateOne) SetNillableName(s *string) *CityUpdateOne {
|
||||
if s != nil {
|
||||
cuo.SetName(*s)
|
||||
}
|
||||
return cuo
|
||||
}
|
||||
|
||||
// AddStreetIDs adds the "streets" edge to the Street entity by IDs.
|
||||
func (cuo *CityUpdateOne) AddStreetIDs(ids ...int) *CityUpdateOne {
|
||||
cuo.mutation.AddStreetIDs(ids...)
|
||||
|
||||
@@ -38,6 +38,14 @@ func (su *StreetUpdate) SetName(s string) *StreetUpdate {
|
||||
return su
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (su *StreetUpdate) SetNillableName(s *string) *StreetUpdate {
|
||||
if s != nil {
|
||||
su.SetName(*s)
|
||||
}
|
||||
return su
|
||||
}
|
||||
|
||||
// SetCityID sets the "city" edge to the City entity by ID.
|
||||
func (su *StreetUpdate) SetCityID(id int) *StreetUpdate {
|
||||
su.mutation.SetCityID(id)
|
||||
@@ -162,6 +170,14 @@ func (suo *StreetUpdateOne) SetName(s string) *StreetUpdateOne {
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (suo *StreetUpdateOne) SetNillableName(s *string) *StreetUpdateOne {
|
||||
if s != nil {
|
||||
suo.SetName(*s)
|
||||
}
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetCityID sets the "city" edge to the City entity by ID.
|
||||
func (suo *StreetUpdateOne) SetCityID(id int) *StreetUpdateOne {
|
||||
suo.mutation.SetCityID(id)
|
||||
|
||||
Reference in New Issue
Block a user