-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (35 loc) · 1.56 KB
/
Makefile
File metadata and controls
49 lines (35 loc) · 1.56 KB
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
createdb:
docker exec -it postgres createdb --username=postgres --owner=postgres simple_bank
dropdb:
docker exec -it postgres dropdb --username=postgres simple_bank
migrateup:
migrate -path db/migration -database "postgresql://postgres:postgres@localhost:5432/simple_bank?sslmode=disable" -verbose up
migrateup1:
migrate -path db/migration -database "postgresql://postgres:postgres@localhost:5432/simple_bank?sslmode=disable" -verbose up 1
migratedown:
migrate -path db/migration -database "postgresql://postgres:postgres@localhost:5432/simple_bank?sslmode=disable" -verbose down
migratedown1:
migrate -path db/migration -database "postgresql://postgres:postgres@localhost:5432/simple_bank?sslmode=disable" -verbose down 1
newmigrate:
migrate create -ext sql -dir db/migration -seq $(name)
dbdocs:
dbdocs build doc/db.dbml --project=simple_bank
dbml2sql:
dbml2sql --postgres -o doc/schema.sql doc/db.dbml
sqlc:
sqlc generate
test:
go test -v -cover ./...
server:
go run main.go
mock:
mockgen -destination db/mock/store.go -package mockdb github.com/NguyenHiu/simple_bank/db/sqlc Store
mockgen -destination worker/mock/distributor.go -package mockwk github.com/NguyenHiu/simple_bank/worker TaskDistributor
proto:
rm -rf pb/*.go
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
.PHONY: createdb dropdb migrateup migrateup1 migratedown migratedown1 newmigrate dbdocs dbml2sql sqlc test server mock proto