Talking about gateways from the Clean Architecture, it is required to distinguish:
- The interfaces
- The implementation of these interfaces
The TypeScript example:
// === Interface ======================================
interface UsersGateway {
retrieveSelection: (requiestParameters: UsersGateway.SelectionRetireving.RequestParameters) =>
Promise<UsersGateway.SelectionRetireving.ResponseData>;
}
namespace UsersGateway {
export namespace SelectionRetireving {
export type RequestParameters = Readonly<{
paginationPageNumber: number;
itemsCountPerPaginationPage: number;
fullOrPartialName? string;
}>;
export type ResponseData = Readonly<{
totalItemsCount: number;
filteredItemsCount: number;
itemsForCurrentPaginationPage: ReadonlyArray<User>;
}>;
}
}
// === Implementation =======================================
class UserMySQL_Gateway implements UserGateway {
retrieveSelection(
requiestParameters: UsersGateway.SelectionRetireving.RequestParameters
): Promise<UsersGateway.SelectionRetireving.ResponseData> {
// Implementation including SQL code here
}
}
Now the question: in below image from Clean Architecture book, the "Gateways" in the green ring are interfaces of their implementations? If one of them, there is another?
My assumptions
Although the frameworks must be in the outer (blue) ring and, I have not seen the framework-independent Controllers and/or Presenters before. Thus, the "gateways" in the green ring could be the implementations which depends on some framework or RDBMS (matching with Interface adapter concept).
If so, there is the gateway interfaces? The table of contents of Chapter 20 Business rules is:
- Entities
- Use Cases
- Request and Response Models
- Conclusion
Are mentioned above Request and Response Models the gateway interfaces?