-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp-client.go
More file actions
42 lines (39 loc) · 998 Bytes
/
http-client.go
File metadata and controls
42 lines (39 loc) · 998 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"go.uber.org/dig"
"log"
"os"
"strconv"
"workplace/internal/injector"
"workplace/internal/services"
)
func main() {
err := injector.GetContainer().Invoke(func(
inject struct {
dig.In
Billing services.BillingProviderInterface
Logger *log.Logger `name:"telegramLogger"`
},
) {
contractId, _ := strconv.Atoi(os.Args[1])
contract, err := inject.Billing.GetContract(contractId)
if err != nil {
inject.Logger.Println("billing get-contract exception:", err.Error())
}
if contract != nil {
log.Println(fmt.Sprintf(
"id: %d; title: %s; balance: %f; house_id: %d",
contract.Id,
contract.Title,
contract.Balance,
contract.HouseId,
),
)
}
})
if err != nil {
log.Println(err)
}
fmt.Scanf("\n")
}