Skip to content

Instantly share code, notes, and snippets.

@bykof
Last active July 1, 2020 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bykof/46ea120b80c223cd66d90494dfdc5a6b to your computer and use it in GitHub Desktop.
Save bykof/46ea120b80c223cd66d90494dfdc5a6b to your computer and use it in GitHub Desktop.
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