Last active
July 1, 2020 09:44
-
-
Save bykof/46ea120b80c223cd66d90494dfdc5a6b to your computer and use it in GitHub Desktop.
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
package interfaces | |
import ( | |
"example.com/dingo_example/infrastructure" | |
"log" | |
) | |
type AppController struct { | |
productAPI infrastructure.ProductAPI | |
} | |
func (ac *AppController) New(productAPI infrastructure.ProductAPI) { | |
ac.productAPI = productAPI | |
} | |
func (ac *AppController) PrintProducts() { | |
productList, err := ac.productAPI.ProductList() | |
if err != nil { | |
log.Fatal(err) | |
} | |
for _, product := range productList { | |
log.Print(product.String()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment