I have this structure:
httpservice
L endpointHandler.go (it has as parameters databaseA and databaseB)
L types.gen.go (autogenerated from the api definition)
storage
L databaseA.go (each database has 'Store(Type)' and 'Get() -> Type' functions)
L databaseB.go
My problem is that I get into circular dependencies errors. The endpointHandler needs to import the storage package to access the databases. The databases need to import the httpservice because the types are autogenerated there (it needs the types in order to store or read the struct).
Is there a way to solve this issue with interfaces? I tried it but it didn't get rid of the circular problems. Some solutions I could think of:
Copy paste the types in the storage package and ignore the generated types
Move the databases inside the httpservice package, and forget about the nice folder structure
PD: There are a lot of questions about circular dependencies but I don't manage to solve my particular problem. Sorry if it's repeated.