-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (45 loc) · 2.13 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
initnetwork:
docker network create bank-network
initdb:
docker run -d --name postgres_container --network bank-network -p5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret postgres:alpine3.17
startdb:
docker start postgres_container
stopdb:
docker stop postgres_container
createdb:
docker exec -it postgres_container createdb simple_bank
dropdb:
docker exec -it postgres_container dropdb simple_bank
test:
go test -v -cover ./...
server:
go run main.go
initdockerserver:
make stopdb
make startdb
docker run --name simplebank --network bank-network -p8080:8080 -e DB_SOURCE="postgresql://root:secret@postgres_container/simple_bank?sslmode=disable" simplebank:latest
startdockerserver:
docker start simplebank
stopdockerserver:
docker stop simplebank
migratecreate:
migrate create -ext sql -dir db/migration -seq init_schema
migrateup:
migrate -path db/migration -database "postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" -verbose up
migratedown:
migrate -path db/migration -database "postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" -verbose down
migrateup1:
migrate -path db/migration -database "postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" -verbose up 1
migratedown1:
migrate -path db/migration -database "postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" -verbose down 1
sqlc:
docker run --rm -v "C:/Users/adria/Desktop/Programmieren/golang/simplebankapp:/src" -w /src kjconroy/sqlc generate
mock:
mockgen -package mockdb -destination db/mock/store.go github.com/oriventi/simplebank/db/sqlc Store
dockerimg:
docker build -t simplebank:latest .
proto:
protoc --proto_path=proto --go_out=pb --go_opt=paths=source_relative --go-grpc_out=pb --go-grpc_opt=paths=source_relative --grpc-gateway_out=pb --grpc-gateway_opt=paths=source_relative proto/*.proto
evans:
evans --host localhost --port 9090 --path proto -r repl
.PHONY: startdockerserver stopdockerserver initdockerserver dockerimg createdb dropdb startdb stopdb initdb migrateup migratedown migrateup1 migratedown1 sqlc migratecreate test server mock proto