Documentation ¶
Overview ¶
Package generate is to generate code, including model, cache, dao, handler, http, service, grpc, grpc-gw, grpc-cli code.
Index ¶
- Constants
- Variables
- func CacheCommand(parentName string) *cobra.Command
- func ConfigCommand() *cobra.Command
- func ConfigmapCommand() *cobra.Command
- func ConvertSwagJSONCommand(parentName string) *cobra.Command
- func DaoCommand(parentName string) *cobra.Command
- func DeleteCodeMark(r replacer.Replacer, filename string, startMark []byte, endMark []byte) []replacer.Field
- func GRPCAndHTTPPbCommand() *cobra.Command
- func GRPCConnectionCommand() *cobra.Command
- func GetDBConfigurationCode(dbDriver string) string
- func GetGoModFields(moduleName string) []replacer.Field
- func GetInitDataBaseCode(dbDriver string) string
- func HTTPCommand() *cobra.Command
- func HTTPPbCommand() *cobra.Command
- func HandlerCommand() *cobra.Command
- func HandlerPbCommand() *cobra.Command
- func Init() error
- func InitFS(name string, filepath string, fs embed.FS)
- func ModelCommand(parentName string) *cobra.Command
- func ParseFuzzyProtobufFiles(protobufFile string) ([]string, error)
- func ProtobufCommand() *cobra.Command
- func RPCCommand() *cobra.Command
- func RPCGwPbCommand() *cobra.Command
- func RPCPbCommand() *cobra.Command
- func ServiceAndHandlerCRUDCommand() *cobra.Command
- func ServiceCommand() *cobra.Command
- func SetSelectFiles(dbDriver string, selectFiles map[string][]string) error
- func SubServerCodeFields(moduleName string, serverName string) []replacer.Field
- type Template
- type Version
Constants ¶
const ( // TplNameSunshine name of the template TplNameSunshine = "sunshine" // DBDriverMysql mysql driver DBDriverMysql = "mysql" // DBDriverPostgresql postgresql driver DBDriverPostgresql = "postgresql" // DBDriverTidb tidb driver DBDriverTidb = "tidb" // DBDriverSqlite sqlite driver DBDriverSqlite = "sqlite" // DBDriverMongodb mongodb driver DBDriverMongodb = "mongodb" )
Variables ¶
var ( ModelInitDBFile = databaseInitDBFile ModelInitDBFileMark = databaseInitDBFileMark //AppConfigFileDBMark = appConfigFileMark2 StartMark = startMark EndMark = endMark )
var (
CurrentDbDriver = func(dbDriver string) string { return "// db driver is " + dbDriver }
)
var Replacers = map[string]replacer.Replacer{}
Replacers replacer name
var SunshineDir = getHomeDir() + gofile.GetPathDelimiter() + ".sunshine"
SunshineDir sunshine directory
Functions ¶
func CacheCommand ¶
CacheCommand generate cache code
func ConfigCommand ¶
ConfigCommand convert yaml to struct command
func ConfigmapCommand ¶
ConfigmapCommand generate k8s configmap command
func ConvertSwagJSONCommand ¶
ConvertSwagJSONCommand convert 64-bit fields type string to integer
func DeleteCodeMark ¶
func DeleteCodeMark(r replacer.Replacer, filename string, startMark []byte, endMark []byte) []replacer.Field
DeleteCodeMark delete code mark fragment
func GRPCAndHTTPPbCommand ¶
GRPCAndHTTPPbCommand generate grpc+http service code bash on protobuf file
func GRPCConnectionCommand ¶
GRPCConnectionCommand generate grpc connection code
func GetDBConfigurationCode ¶
GetDBConfigurationCode get db config code
func GetGoModFields ¶ added in v1.1.18
GetGoModFields get go mod fields
func GetInitDataBaseCode ¶
GetInitDataBaseCode get init db code
func HTTPPbCommand ¶
HTTPPbCommand generate web service code based on protobuf file
func HandlerPbCommand ¶
HandlerPbCommand generate handler and protobuf code
func ModelCommand ¶
ModelCommand generate model code
func ParseFuzzyProtobufFiles ¶ added in v1.1.23
ParseFuzzyProtobufFiles parse fuzzy protobuf files
func RPCGwPbCommand ¶
RPCGwPbCommand generate grpc gateway service code base on protobuf file
func RPCPbCommand ¶
RPCPbCommand generate grpc service code bash on protobuf file
func ServiceAndHandlerCRUDCommand ¶
ServiceAndHandlerCRUDCommand generate both service and handler CRUD code
func SetSelectFiles ¶ added in v1.1.23
nolint