Skip to content

Commit

Permalink
Improve naming of internal types.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Aug 15, 2024
1 parent 39d2103 commit 528348f
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 58 deletions.
22 changes: 11 additions & 11 deletions aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func FromAggregate(h dogma.AggregateMessageHandler) RichAggregate {
return cfg

Check failure on line 32 in aggregate.go

View workflow job for this annotation

GitHub Actions / Shared / Go

cannot use cfg (variable of type *richAggregate) as RichAggregate value in return statement: *richAggregate does not implement RichAggregate (missing method Identity)
}

func fromAggregate(h dogma.AggregateMessageHandler) (*aggregate, *aggregateConfigurer) {
cfg := &aggregate{
handler: handler{
func fromAggregate(h dogma.AggregateMessageHandler) (*richAggregate, *aggregateConfigurer) {
cfg := &richAggregate{
handlerEntity: handlerEntity{

Check failure on line 37 in aggregate.go

View workflow job for this annotation

GitHub Actions / Shared / Go

undefined: handlerEntity
entity: entity{
rt: reflect.TypeOf(h),
},
Expand All @@ -47,7 +47,7 @@ func fromAggregate(h dogma.AggregateMessageHandler) (*aggregate, *aggregateConfi
entityConfigurer: entityConfigurer{
entity: &cfg.entity,

Check failure on line 48 in aggregate.go

View workflow job for this annotation

GitHub Actions / Shared / Go

cfg.entity undefined (type *richAggregate has no field or method entity)
},
handler: &cfg.handler,
handler: &cfg.handlerEntity,
},
}

Expand All @@ -56,25 +56,25 @@ func fromAggregate(h dogma.AggregateMessageHandler) (*aggregate, *aggregateConfi
return cfg, c
}

// aggregate is an implementation of RichAggregate.
type aggregate struct {
handler
// richAggregate the default implementation of [RichAggregate].
type richAggregate struct {
handlerEntity

Check failure on line 61 in aggregate.go

View workflow job for this annotation

GitHub Actions / Shared / Go

undefined: handlerEntity

impl dogma.AggregateMessageHandler
}

func (h *aggregate) AcceptVisitor(ctx context.Context, v Visitor) error {
func (h *richAggregate) AcceptVisitor(ctx context.Context, v Visitor) error {
return v.VisitAggregate(ctx, h)

Check failure on line 67 in aggregate.go

View workflow job for this annotation

GitHub Actions / Shared / Go

cannot use h (variable of type *richAggregate) as Aggregate value in argument to v.VisitAggregate: *richAggregate does not implement Aggregate (missing method Identity)
}

func (h *aggregate) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
func (h *richAggregate) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
return v.VisitRichAggregate(ctx, h)

Check failure on line 71 in aggregate.go

View workflow job for this annotation

GitHub Actions / Shared / Go

cannot use h (variable of type *richAggregate) as RichAggregate value in argument to v.VisitRichAggregate: *richAggregate does not implement RichAggregate (missing method Identity)
}

func (h *aggregate) HandlerType() HandlerType {
func (h *richAggregate) HandlerType() HandlerType {
return AggregateHandlerType
}

func (h *aggregate) Handler() dogma.AggregateMessageHandler {
func (h *richAggregate) Handler() dogma.AggregateMessageHandler {
return h.impl
}
18 changes: 9 additions & 9 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func FromApplication(a dogma.Application) RichApplication {
return cfg
}

func fromApplication(a dogma.Application) (*application, *applicationConfigurer) {
cfg := &application{
func fromApplication(a dogma.Application) (*richApplication, *applicationConfigurer) {
cfg := &richApplication{
entity: entity{
rt: reflect.TypeOf(a),
},
Expand Down Expand Up @@ -79,31 +79,31 @@ func IsApplicationEqual(a, b Application) bool {
a.Handlers().IsEqual(b.Handlers())
}

// application is an implementation of RichApplication.
type application struct {
// richApplication is the default implementation of [RichApplication].
type richApplication struct {
entity

handlers HandlerSet
richHandlers RichHandlerSet
impl dogma.Application
}

func (a *application) AcceptVisitor(ctx context.Context, v Visitor) error {
func (a *richApplication) AcceptVisitor(ctx context.Context, v Visitor) error {
return v.VisitApplication(ctx, a)
}

func (a *application) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
func (a *richApplication) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
return v.VisitRichApplication(ctx, a)
}

func (a *application) Handlers() HandlerSet {
func (a *richApplication) Handlers() HandlerSet {
return a.handlers
}

func (a *application) RichHandlers() RichHandlerSet {
func (a *richApplication) RichHandlers() RichHandlerSet {
return a.richHandlers
}

func (a *application) Application() dogma.Application {
func (a *richApplication) Application() dogma.Application {
return a.impl
}
2 changes: 1 addition & 1 deletion applicationconfigurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type applicationConfigurer struct {
entityConfigurer

app *application
app *richApplication
}

func (c *applicationConfigurer) Identity(name, key string) {
Expand Down
2 changes: 1 addition & 1 deletion entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (m EntityMessageTypes) Foreign() EntityMessageTypes {
return f
}

// entity is a partial implementation of RichEntity.
// entity is a partial implementation of [RichEntity].
type entity struct {
rt reflect.Type

Expand Down
1 change: 1 addition & 0 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func IsHandlerEqual(a, b Handler) bool {
a.MessageNames().IsEqual(b.MessageNames())
}

// handler is a partial implementation of [RichHandler].
type handler struct {
entity
isDisabled bool
Expand Down
2 changes: 1 addition & 1 deletion handlerconfigurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
// - [dogma.ProjectionConfigurer]
type handlerConfigurer struct {
entityConfigurer
handler *handler
handler *handlerEntity

Check failure on line 22 in handlerconfigurer.go

View workflow job for this annotation

GitHub Actions / Shared / Go

undefined: handlerEntity
}

func (c *handlerConfigurer) Disable(...dogma.DisableOption) {
Expand Down
22 changes: 11 additions & 11 deletions integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func FromIntegration(h dogma.IntegrationMessageHandler) RichIntegration {
return cfg
}

func fromIntegration(h dogma.IntegrationMessageHandler) (*integration, *integrationConfigurer) {
cfg := &integration{
handler: handler{
func fromIntegration(h dogma.IntegrationMessageHandler) (*richIntegration, *integrationConfigurer) {
cfg := &richIntegration{
handlerEntity: handlerEntity{
entity: entity{
rt: reflect.TypeOf(h),
},
Expand All @@ -47,7 +47,7 @@ func fromIntegration(h dogma.IntegrationMessageHandler) (*integration, *integrat
entityConfigurer: entityConfigurer{
entity: &cfg.entity,
},
handler: &cfg.handler,
handler: &cfg.handlerEntity,
},
}

Expand All @@ -56,25 +56,25 @@ func fromIntegration(h dogma.IntegrationMessageHandler) (*integration, *integrat
return cfg, c
}

// integration is an implementation of RichIntegration.
type integration struct {
handler
// richIntegration is the default implementation of [RichIntegration].
type richIntegration struct {
handlerEntity

Check failure on line 61 in integration.go

View workflow job for this annotation

GitHub Actions / Shared / Go

undefined: handlerEntity

impl dogma.IntegrationMessageHandler
}

func (h *integration) AcceptVisitor(ctx context.Context, v Visitor) error {
func (h *richIntegration) AcceptVisitor(ctx context.Context, v Visitor) error {
return v.VisitIntegration(ctx, h)
}

func (h *integration) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
func (h *richIntegration) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
return v.VisitRichIntegration(ctx, h)
}

func (h *integration) HandlerType() HandlerType {
func (h *richIntegration) HandlerType() HandlerType {
return IntegrationHandlerType
}

func (h *integration) Handler() dogma.IntegrationMessageHandler {
func (h *richIntegration) Handler() dogma.IntegrationMessageHandler {
return h.impl
}
22 changes: 11 additions & 11 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func FromProcess(h dogma.ProcessMessageHandler) RichProcess {
return cfg
}

func fromProcess(h dogma.ProcessMessageHandler) (*process, *processConfigurer) {
cfg := &process{
handler: handler{
func fromProcess(h dogma.ProcessMessageHandler) (*richProcess, *processConfigurer) {
cfg := &richProcess{
handlerEntity: handlerEntity{
entity: entity{
rt: reflect.TypeOf(h),
},
Expand All @@ -47,7 +47,7 @@ func fromProcess(h dogma.ProcessMessageHandler) (*process, *processConfigurer) {
entityConfigurer: entityConfigurer{
entity: &cfg.entity,
},
handler: &cfg.handler,
handler: &cfg.handlerEntity,
},
}

Expand All @@ -56,25 +56,25 @@ func fromProcess(h dogma.ProcessMessageHandler) (*process, *processConfigurer) {
return cfg, c
}

// process is an implementation of RichProcess.
type process struct {
handler
// richProcess is the default implementation of [RichProcess].
type richProcess struct {
handlerEntity

Check failure on line 61 in process.go

View workflow job for this annotation

GitHub Actions / Shared / Go

undefined: handlerEntity

impl dogma.ProcessMessageHandler
}

func (h *process) AcceptVisitor(ctx context.Context, v Visitor) error {
func (h *richProcess) AcceptVisitor(ctx context.Context, v Visitor) error {
return v.VisitProcess(ctx, h)
}

func (h *process) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
func (h *richProcess) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
return v.VisitRichProcess(ctx, h)
}

func (h *process) HandlerType() HandlerType {
func (h *richProcess) HandlerType() HandlerType {
return ProcessHandlerType
}

func (h *process) Handler() dogma.ProcessMessageHandler {
func (h *richProcess) Handler() dogma.ProcessMessageHandler {
return h.impl
}
24 changes: 12 additions & 12 deletions projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func FromProjection(h dogma.ProjectionMessageHandler) RichProjection {
return cfg
}

func fromProjection(h dogma.ProjectionMessageHandler) (*projection, *projectionConfigurer) {
cfg := &projection{
handler: handler{
func fromProjection(h dogma.ProjectionMessageHandler) (*richProjection, *projectionConfigurer) {
cfg := &richProjection{
handlerEntity: handlerEntity{
entity: entity{
rt: reflect.TypeOf(h),
},
Expand All @@ -51,7 +51,7 @@ func fromProjection(h dogma.ProjectionMessageHandler) (*projection, *projectionC
entityConfigurer: entityConfigurer{
entity: &cfg.entity,
},
handler: &cfg.handler,
handler: &cfg.handlerEntity,
},
projection: cfg,
}
Expand All @@ -61,30 +61,30 @@ func fromProjection(h dogma.ProjectionMessageHandler) (*projection, *projectionC
return cfg, c
}

// projection is an implementation of RichProjection.
type projection struct {
handler
// richProjection is the default implementation of [RichProjection].
type richProjection struct {
handlerEntity

Check failure on line 66 in projection.go

View workflow job for this annotation

GitHub Actions / Shared / Go

undefined: handlerEntity

impl dogma.ProjectionMessageHandler
deliveryPolicy dogma.ProjectionDeliveryPolicy
}

func (h *projection) AcceptVisitor(ctx context.Context, v Visitor) error {
func (h *richProjection) AcceptVisitor(ctx context.Context, v Visitor) error {
return v.VisitProjection(ctx, h)
}

func (h *projection) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
func (h *richProjection) AcceptRichVisitor(ctx context.Context, v RichVisitor) error {
return v.VisitRichProjection(ctx, h)
}

func (h *projection) HandlerType() HandlerType {
func (h *richProjection) HandlerType() HandlerType {
return ProjectionHandlerType
}

func (h *projection) Handler() dogma.ProjectionMessageHandler {
func (h *richProjection) Handler() dogma.ProjectionMessageHandler {
return h.impl
}

func (h *projection) DeliveryPolicy() dogma.ProjectionDeliveryPolicy {
func (h *richProjection) DeliveryPolicy() dogma.ProjectionDeliveryPolicy {
return h.deliveryPolicy
}
2 changes: 1 addition & 1 deletion projectionconfigurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type projectionConfigurer struct {
handlerConfigurer
projection *projection
projection *richProjection
}

func (c *projectionConfigurer) Routes(routes ...dogma.ProjectionRoute) {
Expand Down

0 comments on commit 528348f

Please sign in to comment.