entc/gen/template: remove receiver conflict handling logic (#4356)

* examples: ensure tests is stable

* entc/gen/template: remove receiver conflict handling logic

* examples: codegen

* entc/integration: codegen
This commit is contained in:
Giau. Tran Minh
2025-03-19 15:35:03 +07:00
committed by GitHub
parent 153dfa1782
commit ce61476d6d
329 changed files with 11841 additions and 11845 deletions

View File

@@ -20,8 +20,8 @@ type TenantCreate struct {
}
// SetName sets the "name" field.
func (_c *TenantCreate) SetName(s string) *TenantCreate {
_c.mutation.SetName(s)
func (_c *TenantCreate) SetName(v string) *TenantCreate {
_c.mutation.SetName(v)
return _c
}

View File

@@ -28,15 +28,15 @@ func (_u *TenantUpdate) Where(ps ...predicate.Tenant) *TenantUpdate {
}
// SetName sets the "name" field.
func (_u *TenantUpdate) SetName(s string) *TenantUpdate {
_u.mutation.SetName(s)
func (_u *TenantUpdate) SetName(v string) *TenantUpdate {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *TenantUpdate) SetNillableName(s *string) *TenantUpdate {
if s != nil {
_u.SetName(*s)
func (_u *TenantUpdate) SetNillableName(v *string) *TenantUpdate {
if v != nil {
_u.SetName(*v)
}
return _u
}
@@ -73,7 +73,7 @@ func (_u *TenantUpdate) ExecX(ctx context.Context) {
}
}
func (_u *TenantUpdate) sqlSave(ctx context.Context) (n int, err error) {
func (_u *TenantUpdate) sqlSave(ctx context.Context) (_node int, err error) {
_spec := sqlgraph.NewUpdateSpec(tenant.Table, tenant.Columns, sqlgraph.NewFieldSpec(tenant.FieldID, field.TypeInt))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
@@ -85,7 +85,7 @@ func (_u *TenantUpdate) sqlSave(ctx context.Context) (n int, err error) {
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(tenant.FieldName, field.TypeString, value)
}
if n, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{tenant.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -94,7 +94,7 @@ func (_u *TenantUpdate) sqlSave(ctx context.Context) (n int, err error) {
return 0, err
}
_u.mutation.done = true
return n, nil
return _node, nil
}
// TenantUpdateOne is the builder for updating a single Tenant entity.
@@ -106,15 +106,15 @@ type TenantUpdateOne struct {
}
// SetName sets the "name" field.
func (_u *TenantUpdateOne) SetName(s string) *TenantUpdateOne {
_u.mutation.SetName(s)
func (_u *TenantUpdateOne) SetName(v string) *TenantUpdateOne {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *TenantUpdateOne) SetNillableName(s *string) *TenantUpdateOne {
if s != nil {
_u.SetName(*s)
func (_u *TenantUpdateOne) SetNillableName(v *string) *TenantUpdateOne {
if v != nil {
_u.SetName(*v)
}
return _u
}

View File

@@ -20,14 +20,14 @@ type UserCreate struct {
}
// SetName sets the "name" field.
func (_c *UserCreate) SetName(s string) *UserCreate {
_c.mutation.SetName(s)
func (_c *UserCreate) SetName(v string) *UserCreate {
_c.mutation.SetName(v)
return _c
}
// SetTenantID sets the "tenant_id" field.
func (_c *UserCreate) SetTenantID(i int) *UserCreate {
_c.mutation.SetTenantID(i)
func (_c *UserCreate) SetTenantID(v int) *UserCreate {
_c.mutation.SetTenantID(v)
return _c
}

View File

@@ -28,37 +28,37 @@ func (_u *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
}
// SetName sets the "name" field.
func (_u *UserUpdate) SetName(s string) *UserUpdate {
_u.mutation.SetName(s)
func (_u *UserUpdate) SetName(v string) *UserUpdate {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *UserUpdate) SetNillableName(s *string) *UserUpdate {
if s != nil {
_u.SetName(*s)
func (_u *UserUpdate) SetNillableName(v *string) *UserUpdate {
if v != nil {
_u.SetName(*v)
}
return _u
}
// SetTenantID sets the "tenant_id" field.
func (_u *UserUpdate) SetTenantID(i int) *UserUpdate {
func (_u *UserUpdate) SetTenantID(v int) *UserUpdate {
_u.mutation.ResetTenantID()
_u.mutation.SetTenantID(i)
_u.mutation.SetTenantID(v)
return _u
}
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (_u *UserUpdate) SetNillableTenantID(i *int) *UserUpdate {
if i != nil {
_u.SetTenantID(*i)
func (_u *UserUpdate) SetNillableTenantID(v *int) *UserUpdate {
if v != nil {
_u.SetTenantID(*v)
}
return _u
}
// AddTenantID adds i to the "tenant_id" field.
func (_u *UserUpdate) AddTenantID(i int) *UserUpdate {
_u.mutation.AddTenantID(i)
// AddTenantID adds value to the "tenant_id" field.
func (_u *UserUpdate) AddTenantID(v int) *UserUpdate {
_u.mutation.AddTenantID(v)
return _u
}
@@ -94,7 +94,7 @@ func (_u *UserUpdate) ExecX(ctx context.Context) {
}
}
func (_u *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
_spec := sqlgraph.NewUpdateSpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
@@ -112,7 +112,7 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if value, ok := _u.mutation.AddedTenantID(); ok {
_spec.AddField(user.FieldTenantID, field.TypeInt, value)
}
if n, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{user.Label}
} else if sqlgraph.IsConstraintError(err) {
@@ -121,7 +121,7 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
return 0, err
}
_u.mutation.done = true
return n, nil
return _node, nil
}
// UserUpdateOne is the builder for updating a single User entity.
@@ -133,37 +133,37 @@ type UserUpdateOne struct {
}
// SetName sets the "name" field.
func (_u *UserUpdateOne) SetName(s string) *UserUpdateOne {
_u.mutation.SetName(s)
func (_u *UserUpdateOne) SetName(v string) *UserUpdateOne {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne {
if s != nil {
_u.SetName(*s)
func (_u *UserUpdateOne) SetNillableName(v *string) *UserUpdateOne {
if v != nil {
_u.SetName(*v)
}
return _u
}
// SetTenantID sets the "tenant_id" field.
func (_u *UserUpdateOne) SetTenantID(i int) *UserUpdateOne {
func (_u *UserUpdateOne) SetTenantID(v int) *UserUpdateOne {
_u.mutation.ResetTenantID()
_u.mutation.SetTenantID(i)
_u.mutation.SetTenantID(v)
return _u
}
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (_u *UserUpdateOne) SetNillableTenantID(i *int) *UserUpdateOne {
if i != nil {
_u.SetTenantID(*i)
func (_u *UserUpdateOne) SetNillableTenantID(v *int) *UserUpdateOne {
if v != nil {
_u.SetTenantID(*v)
}
return _u
}
// AddTenantID adds i to the "tenant_id" field.
func (_u *UserUpdateOne) AddTenantID(i int) *UserUpdateOne {
_u.mutation.AddTenantID(i)
// AddTenantID adds value to the "tenant_id" field.
func (_u *UserUpdateOne) AddTenantID(v int) *UserUpdateOne {
_u.mutation.AddTenantID(v)
return _u
}