Skip to content

Commit 5eb0c36

Browse files
committed
fix: update Makefile
1 parent 9b2cc04 commit 5eb0c36

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

api/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ gen-api: # Generate API files | 生成 API 的代码
3737
swagger generate spec --output=./$(PROJECT).yml --scan-models
3838
@echo "Generate API codes successfully"
3939

40+
.PHONY: gen-ent
41+
gen-ent: # Generate Ent codes | 生成 Ent 的代码
42+
go run -mod=mod entgo.io/ent/cmd/ent generate --template glob="./ent/template/*.tmpl" ./ent/schema
43+
@echo "Generate Ent successfully"
44+
45+
.PHONY: gen-api-ent-logic
46+
gen-api-ent-logic: # Generate CRUD logic from Ent, need to set model and group | 根据 Ent 生成 CRUD 代码,需要设置 model 和 group
47+
goctls api ent --schema=./ent/schema --api_service_name=$(PROJECT) --o=./ --model=$(model) --group=$(group)
48+
@echo "Generate CRUD codes from Ent successfully"
49+
4050
.PHONY: build-win
4151
build-win: # Build project for Windows | 构建Windows下的可执行文件
4252
env CGO_ENABLED=0 GOOS=windows go build -ldflags "$(LDFLAGS)" -o $(PROJECT).exe $(PROJECT).go

0 commit comments

Comments
 (0)