mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
entc/mutation: explain when object is fetched from db (#496)
This commit is contained in:
@@ -138,7 +138,9 @@ func (m *CityMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the City.
|
||||
// If the City object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *CityMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -504,7 +506,9 @@ func (m *StreetMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the Street.
|
||||
// If the Street object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *StreetMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -138,7 +138,9 @@ func (m *GroupMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the Group.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *GroupMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -507,7 +509,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -561,7 +565,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -139,7 +139,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -193,7 +195,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -141,7 +141,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -195,7 +197,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -138,7 +138,9 @@ func (m *PetMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the Pet.
|
||||
// If the Pet object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *PetMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -501,7 +503,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -555,7 +559,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -140,7 +140,9 @@ func (m *NodeMutation) Value() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldValue returns the old value value, if exists.
|
||||
// OldValue returns the old value value of the Node.
|
||||
// If the Node object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *NodeMutation) OldValue(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -140,7 +140,9 @@ func (m *CardMutation) Expired() (r time.Time, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldExpired returns the old expired value, if exists.
|
||||
// OldExpired returns the old expired value of the Card.
|
||||
// If the Card object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *CardMutation) OldExpired(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -175,7 +177,9 @@ func (m *CardMutation) Number() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldNumber returns the old number value, if exists.
|
||||
// OldNumber returns the old number value of the Card.
|
||||
// If the Card object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *CardMutation) OldNumber(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -555,7 +559,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -609,7 +615,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -139,7 +139,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -193,7 +195,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -140,7 +140,9 @@ func (m *NodeMutation) Value() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldValue returns the old value value, if exists.
|
||||
// OldValue returns the old value value of the Node.
|
||||
// If the Node object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *NodeMutation) OldValue(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -142,7 +142,9 @@ func (m *CarMutation) Model() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldModel returns the old model value, if exists.
|
||||
// OldModel returns the old model value of the Car.
|
||||
// If the Car object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *CarMutation) OldModel(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -177,7 +179,9 @@ func (m *CarMutation) RegisteredAt() (r time.Time, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldRegisteredAt returns the old registered_at value, if exists.
|
||||
// OldRegisteredAt returns the old registered_at value of the Car.
|
||||
// If the Car object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *CarMutation) OldRegisteredAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -554,7 +558,9 @@ func (m *GroupMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the Group.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *GroupMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -925,7 +931,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -979,7 +987,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
@@ -142,7 +142,9 @@ func (m *GroupMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the Group.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *GroupMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -567,7 +569,9 @@ func (m *PetMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the Pet.
|
||||
// If the Pet object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *PetMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -999,7 +1003,9 @@ func (m *UserMutation) Age() (r int, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAge returns the old age value, if exists.
|
||||
// OldAge returns the old age value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldAge(ctx context.Context) (v int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
@@ -1053,7 +1059,9 @@ func (m *UserMutation) Name() (r string, exists bool) {
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldName returns the old name value, if exists.
|
||||
// OldName returns the old name value of the User.
|
||||
// If the User object wasn't provided to the builder, the object is fetched
|
||||
// from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
|
||||
func (m *UserMutation) OldName(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
|
||||
Reference in New Issue
Block a user