Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Svc ¶
type Svc struct { // Handler indicates whether generate default http handler implementation code or not Handler bool // Client is client language name Client string // 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 // ImagePrefix is image name prefix string used for building and pushing docker image ImagePrefix string // 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 statefulset kind using statefulset.yaml file in the project root, so if you want to deploy a monolithic project, please set k8sfile flag.
func (Svc) GenClient ¶
func (receiver Svc) GenClient()
GenClient generates http client code from OpenAPI3.0 description json file, only support Golang currently.
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 ¶
Push executes go mod vendor command first, then build docker image and push to remote image repository It also generates deployment kind(for monolithic) and statefulset kind(for microservice) 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.