Created
April 18, 2022 09:42
-
-
Save liampulles/f62dbe42763a686df8fe1935fad4f059 to your computer and use it in GitHub Desktop.
Example of wiring from Matchstick Video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CreateServerFactory injects all the dependencies needed to create | |
// http.ServerFactory | |
func CreateServerFactory(source goConfig.Source) (http.ServerFactory, error) { | |
// Each "tap" below indicates a level of dependency | |
configStore, err := config.NewStoreImpl( | |
source, | |
) | |
if err != nil { | |
return nil, err | |
} | |
errorParser := adapterDb.NewErrorParserImpl() | |
// --- NEXT TAP --- | |
helperService := sql.NewHelperServiceImpl(errorParser) | |
databaseService, err := db.NewDatabaseServiceImpl( | |
configStore, | |
) | |
if err != nil { | |
return nil, err | |
} | |
inventoryItemConstructor := entity.NewInventoryItemConstructorImpl() | |
muxWrapper := mux.NewWrapperImpl() | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment