The repository pattern gets you far. It keeps your persistence logic behind a clean interface, your domain entities free of database concerns, and your application code easy to test. Most services start here and it works well — until you need to fetch data that doesn't map cleanly to a single entity.
A joined query. An aggregate function result. A response that pulls from three tables and returns something none of your domain types actually represent. The temptation at that point is to reach for the repository anyway and invent a new type to hold the result:
type OrderWithTotal struct {
Order
Total float64