entc/mutation: explain when object is fetched from db (#496)

This commit is contained in:
Ariel Mashraki
2020-05-21 10:10:52 +03:00
committed by GitHub
parent 5ed339839a
commit dbf6bb8006
23 changed files with 539 additions and 181 deletions

View File

@@ -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) {