Skip to content

Commit

Permalink
Merge pull request #6 from octoposprime/fix/adg/4/dto-entity-pointer-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sddilora authored Mar 27, 2024
2 parents 250099c + 86363fb commit e8e74ee
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/infrastructure/adapter/repository/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions pkg/infrastructure/mapper/ebus/logdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/infrastructure/mapper/repository/logdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/presentation/dto/logdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/presentation/dto/logdatafilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e8e74ee

Please sign in to comment.