From 86363fbbbf1cd3c8fec2b5c941b64a65c25e8071 Mon Sep 17 00:00:00 2001 From: furkanadiiguzel Date: Sun, 17 Mar 2024 17:04:47 +0300 Subject: [PATCH] fix: correct shared state removing pointer --- pkg/infrastructure/adapter/repository/db.go | 2 +- pkg/infrastructure/mapper/ebus/logdata.go | 4 ++-- pkg/infrastructure/mapper/repository/logdata.go | 4 ++-- pkg/presentation/dto/logdata.go | 4 ++-- pkg/presentation/dto/logdatafilter.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/infrastructure/adapter/repository/db.go b/pkg/infrastructure/adapter/repository/db.go index 5ccdcf8..7a61ed0 100644 --- a/pkg/infrastructure/adapter/repository/db.go +++ b/pkg/infrastructure/adapter/repository/db.go @@ -29,7 +29,7 @@ func NewDbAdapter(dbClient *tgorm.GormClient) DbAdapter { } func (a DbAdapter) Log(ctx context.Context, logData me.LogData) { - logDbMapper := map_repo.NewLogDataFromEntity(&logData) + logDbMapper := map_repo.NewLogDataFromEntity(logData) result := a.DbClient.Save(&logDbMapper) if result.Error != nil { fmt.Println(tserialize.NewSerializer(logData).ToJson()) diff --git a/pkg/infrastructure/mapper/ebus/logdata.go b/pkg/infrastructure/mapper/ebus/logdata.go index f88bf72..b3dde13 100644 --- a/pkg/infrastructure/mapper/ebus/logdata.go +++ b/pkg/infrastructure/mapper/ebus/logdata.go @@ -62,7 +62,7 @@ func NewLogDataFromPb(pb *pb.LogData) *LogData { } // NewLogDataFromEntity creates a new *LogData from entity. -func NewLogDataFromEntity(entity *me.LogData) *LogData { +func NewLogDataFromEntity(entity me.LogData) *LogData { return &LogData{ &pb.LogData{ Id: entity.Id.String(), @@ -108,7 +108,7 @@ type LogDatas []*LogData func NewLogDataFromEntities(entities []me.LogData) LogDatas { logDatas := make([]*LogData, len(entities)) for i, entity := range entities { - logDatas[i] = NewLogDataFromEntity(&entity) + logDatas[i] = NewLogDataFromEntity(entity) } return logDatas } diff --git a/pkg/infrastructure/mapper/repository/logdata.go b/pkg/infrastructure/mapper/repository/logdata.go index ed6a4af..8ff87db 100644 --- a/pkg/infrastructure/mapper/repository/logdata.go +++ b/pkg/infrastructure/mapper/repository/logdata.go @@ -60,7 +60,7 @@ func (s *LogData) String() string { } // NewLogDataFromEntity creates a new *LogData from entity. -func NewLogDataFromEntity(entity *me.LogData) *LogData { +func NewLogDataFromEntity(entity me.LogData) *LogData { return &LogData{ Model: tgorm.Model{ID: entity.Id}, EventDate: entity.LogHeader.EventDate, @@ -97,7 +97,7 @@ type LogDatas []*LogData func NewLogDataFromEntities(entities []me.LogData) LogDatas { logDatas := make([]*LogData, len(entities)) for i, entity := range entities { - logDatas[i] = NewLogDataFromEntity(&entity) + logDatas[i] = NewLogDataFromEntity(entity) } return logDatas } diff --git a/pkg/presentation/dto/logdata.go b/pkg/presentation/dto/logdata.go index da1488c..f0de848 100644 --- a/pkg/presentation/dto/logdata.go +++ b/pkg/presentation/dto/logdata.go @@ -62,7 +62,7 @@ func NewLogDataFromPb(pb *pb.LogData) *LogData { } // NewLogDataFromEntity creates a new *LogData from entity. -func NewLogDataFromEntity(entity *me.LogData) *LogData { +func NewLogDataFromEntity(entity me.LogData) *LogData { return &LogData{ &pb.LogData{ Id: entity.Id.String(), @@ -112,7 +112,7 @@ type LogDatas []*LogData func NewLogDataFromEntities(entities []me.LogData) LogDatas { logDatas := make([]*LogData, len(entities)) for i, entity := range entities { - logDatas[i] = NewLogDataFromEntity(&entity) + logDatas[i] = NewLogDataFromEntity(entity) } return logDatas } diff --git a/pkg/presentation/dto/logdatafilter.go b/pkg/presentation/dto/logdatafilter.go index b10b56f..0927a85 100644 --- a/pkg/presentation/dto/logdatafilter.go +++ b/pkg/presentation/dto/logdatafilter.go @@ -83,7 +83,7 @@ func NewLogDataFilterFromPb(pb *pb.LogDataFilter) *LogDataFilter { } // NewLogDataFilterFromEntity creates a new *LogDataFilter from entity. -func NewLogDataFilterFromEntity(entity *me.LogDataFilter) *LogDataFilter { +func NewLogDataFilterFromEntity(entity me.LogDataFilter) *LogDataFilter { id := entity.Id.String() eventDateFrom := timestamppb.New(entity.EventDateFrom) eventDateTo := timestamppb.New(entity.EventDateTo)