-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
27 lines (22 loc) · 641 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"fmt"
"log"
"os"
"github.com/gophers-latam/small-template/domain"
"github.com/gophers-latam/small-template/internal"
"github.com/gophers-latam/small-template/services"
"github.com/gophers-latam/small-template/storage"
)
func main() {
logger := internal.NewLogger(os.Stdout, log.Ldate|log.Ltime)
repository := storage.NewMemoryRepository()
service := services.NewProductService(repository, logger)
product := &domain.Product{
Name: "Gophers LATAM t-shirt",
Price: 20,
}
service.Save(product)
p := service.Get(1)
fmt.Printf("Gotten product; Id: %d, Name: %s, Price: %f", p.Id, p.Name, p.Price)
}