Skip to content

Commit

Permalink
Remvoe redundant codes
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybka committed Mar 19, 2023
1 parent 18ea5fc commit b9826b3
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 221 deletions.
10 changes: 3 additions & 7 deletions domain/entity/base_aggregate_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ type BaseAggregateRoot struct {
domainEvents []event.IBaseDomainEvent
}

func NewBaseAggregateRoot() (BaseAggregateRoot, error) {
base, err := NewBaseEntity()
if err != nil {
return BaseAggregateRoot{}, nil
}

func NewBaseAggregateRoot(rootEntityId uint) BaseAggregateRoot {
base := NewBaseEntity(rootEntityId)
events := make([]event.IBaseDomainEvent, 0)

return BaseAggregateRoot{
BaseEntity: base,
domainEvents: events,
}, nil
}
}

func (aggregate *BaseAggregateRoot) AddEvent(event event.IBaseDomainEvent) {
Expand Down
14 changes: 3 additions & 11 deletions domain/entity/base_entity.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
package entity

import "github.com/google/uuid"

type BaseEntity struct {
ID uuid.UUID
ID uint
}

func NewBaseEntity() (BaseEntity, error) {
id, err := uuid.NewUUID()

if err != nil {
return BaseEntity{}, err
}

return BaseEntity{ID: id}, nil
func NewBaseEntity(id uint) BaseEntity {
return BaseEntity{ID: id}
}
15 changes: 0 additions & 15 deletions infrastructure/persistence/base_model.go

This file was deleted.

61 changes: 0 additions & 61 deletions infrastructure/tests/sqlite_db_connect.go

This file was deleted.

11 changes: 0 additions & 11 deletions samples/persistence/account/account_model.go

This file was deleted.

45 changes: 0 additions & 45 deletions samples/persistence/account/account_repository.go

This file was deleted.

68 changes: 0 additions & 68 deletions samples/persistence/account/account_repository_test.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package customgorm
package types

import (
"database/sql/driver"
Expand All @@ -17,12 +17,12 @@ func CustomTypeUUIDv1FromString(s string) CustomTypeUUIDv1 {
return CustomTypeUUIDv1(uuid.MustParse(s))
}

//String -> String Representation of Binary16
// String -> String Representation of Binary16
func (my CustomTypeUUIDv1) String() string {
return uuid.UUID(my).String()
}

//GormDataType -> sets type to binary(16)
// GormDataType -> sets type to binary(16)
func (my CustomTypeUUIDv1) GormDataType() string {
return "binary(16)"
}
Expand Down

0 comments on commit b9826b3

Please sign in to comment.