-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (47 loc) · 1.93 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
55
56
57
58
59
60
61
62
63
ifneq ($(ls backend/gapi/pb),)
DELETE_COMMAND=cd backend/gapi/pb&&del *pb.go
else
DELETE_COMMAND=$(echo "already empty")
endif
sqlc:
sqlc generate
make mock
migratecreate:
migrate create -ext sql -dir backend/db/migrate -seq $(name)
migrateup:
migrate -path backend/db/migrate -database "mysql://root:123@tcp(localhost:3306)/bitmoi" -verbose up
migratedown:
migrate -path backend/db/migrate -database "mysql://root:123@tcp(localhost:3306)/bitmoi" -verbose down
migrateup1:
migrate -path backend/db/migrate -database "mysql://root:123@tcp(localhost:3306)/bitmoi" -verbose up 1
migratedown1:
migrate -path backend/db/migrate -database "mysql://root:123@tcp(localhost:3306)/bitmoi" -verbose down 1
mock:
mockgen -package mockdb -destination backend/db/mock/store.go bitmoi/backend/db/sqlc Store
mockgen -package mocktask -destination backend/worker/mock/distributor.go bitmoi/backend/worker TaskDistributor
delete:
$(DELETE_COMMAND)
proto: delete
protoc \
--proto_path=backend/gapi/proto --go_out=backend/gapi/pb \
--go_opt=paths=source_relative --go-grpc_out=backend/gapi/pb \
--go-grpc_opt=paths=source_relative \
--grpc-gateway_out=backend/gapi/pb --grpc-gateway_opt=paths=source_relative \
--validate_out="lang=go:backend/gapi/pb" --validate_opt=paths=source_relative \
backend/gapi/proto/*.proto
reactproto:
npx grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:frontend/src/component/pb \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:frontend/src/component/pb \
--proto_path=backend/gapi/proto \
backend/gapi/proto/*.proto
rmi:
docker compose down && docker rmi bitmoi_api
test:
go test -v -cover -short ./backend/...
benchmark:
go-wrk -c 80 -d 5 -H Content-Type:application/json -M GET http://43.202.77.76:5000/practice
swag:
rm -rf ./frontend/server/docs
swag init --output ./frontend/server/docs
.PHONY: sqlc migrateup migratedown migrateup1 migratedown1 mock proto reactproto rmi test benchmark swag