Documentation
¶
Overview ¶
Package port defines repository and other ports (interfaces) used by use cases. Implementations live in infrastructure (e.g. repositories package); domain does not depend on them.
Role in architecture:
- Ports: interfaces that use cases depend on; implemented by adapters in other packages.
Responsibilities:
- Define minimal, use-case-oriented interfaces (e.g. GetByID).
- No methods except those required by use cases; avoid fat interfaces.
This package must NOT:
- Import infrastructure packages or contain implementations.
- Define business rules; only interface contracts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetByID ¶
GetByID is a minimal read port for use cases that fetch an entity by ID.
Implementations adapt infrastructure (e.g. repositories.BaseRepository) to this interface. Use in use cases so they depend only on domain; wire a concrete implementation in main.
Contract:
- ctx: used for cancellation and timeouts; implementations must pass it to storage calls.
- id: non-empty identifier (format is implementation-defined).
- Returns (value, true, nil) when found, (nil, false, nil) when not found, (nil, false, err) on error.
Error contract: do not return (nil, true, err). On storage errors return (nil, false, err).
Click to show internal directories.
Click to hide internal directories.