Skip to content

Features added for kratos

leanfra edited this page Nov 30, 2024 · 2 revisions

Added Features

  1. generate model struct code under internal/biz for each service
  • For the message with the specific comment in the proto file (see option -c), generate the corresponding golang struct code in specific file(set option -m).
  1. generate biz code under internal/biz for each service
  • Generate the corresponding biz/usecase layer code based on RPC service.
  • Also including Repo interface need implemented in data layer.
  1. generate data code under internal/data for each service
  • Generate the corresponding data layer code based on RPC service.
  1. add overwrite flag
  • Enable force overwrite the existing files.

Added commands and options

❯ gratos proto server --help
Generate the proto server implementations. Example: kratos proto server api/xxx.proto --target-dir=internal/service

Usage:
  kratos proto server [flags]

Flags:
  -b, --biz-dir string         generated biz directory. one file per service (default "internal/biz")
  -d, --data-dir string        generated data directory. one file per service (default "internal/data")
  -h, --help                   help for server
  -c, --model-comment string   comment tag to message converted to model (default "gratos::model")
  -m, --model-file string      generated model file under biz directory (default "models.go")
  -f, --over-write             force over write existed file
  -t, --service-dir string     generated service directory. one file per service (default "internal/service")


Clone this wiki locally