Files
goplt/docs/content/stories/phase4/4.7.1-create-modulesblogpkgmodulego.md

1.5 KiB

Task 4.7.1: Create modules/blog/pkg/module.go:

Metadata

  • Task ID: 4.7.1
  • Title: Create modules/blog/pkg/module.go:
  • Phase: 4 - Sample Feature Module (Blog)
  • Section: 4.7
  • Status: Pending
  • Priority: High
  • Estimated Time: TBD
  • Dependencies: TBD

Description

Create modules/blog/pkg/module.go:

Requirements

  • Create modules/blog/pkg/module.go:

Implementation Steps

  1. TODO: Add implementation steps
  2. TODO: Add implementation steps
  3. TODO: Add implementation steps

Acceptance Criteria

  • Task 4.7.1 is completed
  • All requirements are met
  • Code compiles and tests pass
  • See relevant ADRs in docs/adr/

Implementation Notes

  • TODO: Add implementation notes

Testing

# TODO: Add test commands
go test ./...

Code Reference

type BlogModule struct{}
  
  func (b BlogModule) Name() string { return "blog" }
  func (b BlogModule) Version() string { return "0.1.0" }
  func (b BlogModule) Dependencies() []string { return nil }
  func (b BlogModule) Init() fx.Option {
      return fx.Options(
          fx.Provide(NewPostRepo),
          fx.Provide(NewPostService),
          fx.Invoke(RegisterHandlers),
      )
  }
  func (b BlogModule) Migrations() []func(*ent.Client) error {
      return []func(*ent.Client) error{
          func(c *ent.Client) error {
              return c.Schema.Create(context.Background())
          },
      }
  }
  
  var Module BlogModule
  
  func init() {
      registry.Register(Module)
  }