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 GetInitDataBaseCode(dbDriver string) string
- func HTTPCommand() *cobra.Command
- func HTTPPbCommand() *cobra.Command
- func HandlerCommand() *cobra.Command
- func HandlerPbCommand() *cobra.Command
- func Init(name string, filepath string) error
- func InitFS(name string, filepath string, fs embed.FS)
- func ModelCommand(parentName string) *cobra.Command
- 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 SubServerCodeFields(outDir string, moduleName string, serverName string) []replacer.Field
- type Template
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 = modelInitDBFile ModelInitDBFileMark = modelInitDBFileMark AppConfigFileDBMark = appConfigFileMark2 StartMark = startMark EndMark = endMark )
var Replacers = map[string]replacer.Replacer{}
Replacers replacer name
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 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 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