Documentation ¶
Index ¶
- func ValidateDataType(dir string)
- func ValidateRestApi(dir string, ic astutils.InterfaceCollector)
- type ISvc
- type PushConfig
- type Svc
- func (receiver *Svc) Deploy(k8sfile string)
- func (receiver *Svc) DoRestart()
- func (receiver *Svc) DoRun()
- func (receiver *Svc) DoWatch()
- func (receiver *Svc) GenClient()
- func (receiver *Svc) GenIntegrationTestingCode()
- func (receiver *Svc) GetDir() string
- func (receiver *Svc) GetWatcher() *watcher.Watcher
- func (receiver *Svc) Grpc(p v3.ProtoGenerator)
- func (receiver *Svc) Http()
- func (receiver *Svc) Init()
- func (receiver *Svc) Push(cfg PushConfig)
- func (receiver *Svc) Run(watch bool)
- func (receiver *Svc) SetWatcher(w *watcher.Watcher)
- func (receiver *Svc) Shutdown(k8sfile string)
- func (receiver *Svc) Upgrade(version string)
- type SvcOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateDataType ¶
func ValidateDataType(dir string)
func ValidateRestApi ¶
func ValidateRestApi(dir string, ic astutils.InterfaceCollector)
ValidateRestApi is checking whether parameter types in each of service interface methods valid or not Only support at most one golang non-built-in type as parameter in a service interface method because go-doudou cannot put more than one parameter into request body except v3.FileModel. If there are v3.FileModel parameters, go-doudou will assume you want a multipart/form-data api Support struct, map[string]ANY, built-in type and corresponding slice only Not support anonymous struct as parameter
Types ¶
type ISvc ¶
type PushConfig ¶ added in v2.0.3
type Svc ¶
type Svc struct { // Handler indicates whether generate default http handler implementation code or not Handler bool // Client is client language name Client bool // Omitempty indicates whether omit empty when marshal structs to json Omitempty bool // Doc indicates whether generate OpenAPI 3.0 json doc file Doc bool // Jsonattrcase is attribute case converter name when marshal structs to json Jsonattrcase string // DocPath is OpenAPI 3.0 json doc file path used for generating client code DocPath string // Env is service base url environment variable name used for generating client code Env string // ClientPkg is client package name ClientPkg string // for being compatible with legacy code purpose only RoutePatternStrategy int // ModName is go module name ModName string // PostmanCollectionPath is postman collection v2.1 compatible file disk path PostmanCollectionPath string // DotenvPath dotenv format config file disk path only for integration testing purpose DotenvPath string // AllowGetWithReqBody indicates whether allow get http request with request body. // If true, when you defined a get api with struct type parameter in svc.go file, // it will try to decode json format encoded request body. AllowGetWithReqBody bool // contains filtered or unexported fields }
Svc wraps all config properties for commands
func (*Svc) Deploy ¶
Deploy deploys project to kubernetes. If k8sfile flag not set, it will be deployed as deployment kind using *_deployment.yaml file in the project root,
func (*Svc) GenClient ¶
func (receiver *Svc) GenClient()
GenClient generates http client code from OpenAPI3.0 description json file, only support Golang currently.
func (*Svc) GenIntegrationTestingCode ¶
func (receiver *Svc) GenIntegrationTestingCode()
GenIntegrationTestingCode generates integration testing code from postman collection v2.1 compatible file
func (*Svc) GetWatcher ¶
func (*Svc) Grpc ¶
func (receiver *Svc) Grpc(p v3.ProtoGenerator)
func (*Svc) Http ¶
func (receiver *Svc) Http()
Http generates main function, config files, db connection function, http routes, http handlers, service interface and service implementation from the result of ast parsing svc.go file in the project root. It may panic if validation failed
func (*Svc) Push ¶
func (receiver *Svc) Push(cfg PushConfig)
Push executes go mod vendor command first, then build docker image and push to remote image repository It also generates deployment kind and statefulset kind yaml files for kubernetes deploy, if these files already exist, it will only change the image version in each file, so you can edit these files manually to fit your need.
func (*Svc) Run ¶
Run runs the project locally. Recommend to set watch flag to enable watch mode for rapid development.