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(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(moduleName string, serverName string) []replacer.Field
- type Template
Constants ¶
const ( // TplNameSponge name of the template TplNameSponge = "sponge" // 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 ¶ added in v1.4.2
CacheCommand generate cache code
func ConfigCommand ¶
ConfigCommand convert yaml to struct command
func ConfigmapCommand ¶ added in v1.6.0
ConfigmapCommand generate k8s configmap command
func ConvertSwagJSONCommand ¶ added in v1.4.2
ConvertSwagJSONCommand convert 64-bit fields type string to integer
func DeleteCodeMark ¶ added in v1.6.0
func DeleteCodeMark(r replacer.Replacer, filename string, startMark []byte, endMark []byte) []replacer.Field
DeleteCodeMark delete code mark fragment
func GRPCAndHTTPPbCommand ¶ added in v1.8.0
GRPCAndHTTPPbCommand generate grpc+http service code bash on protobuf file
func GRPCConnectionCommand ¶ added in v1.6.0
GRPCConnectionCommand generate grpc connection code
func GetDBConfigurationCode ¶ added in v1.8.0
GetDBConfigurationCode get db config code
func GetGoModFields ¶ added in v1.10.0
GetGoModFields get go mod fields
func GetInitDataBaseCode ¶ added in v1.6.0
GetInitDataBaseCode get init db code
func HTTPPbCommand ¶ added in v1.2.0
HTTPPbCommand generate web service code based on protobuf file
func HandlerPbCommand ¶ added in v1.5.0
HandlerPbCommand generate handler and protobuf code
func ModelCommand ¶
ModelCommand generate model code
func ProtobufCommand ¶ added in v1.6.0
ProtobufCommand generate protobuf code
func RPCCommand ¶ added in v1.2.0
RPCCommand generate grpc service code
func RPCGwPbCommand ¶ added in v1.2.0
RPCGwPbCommand generate grpc gateway service code base on protobuf file
func RPCPbCommand ¶ added in v1.2.0
RPCPbCommand generate grpc service code bash on protobuf file
func ServiceAndHandlerCRUDCommand ¶ added in v1.8.0
ServiceAndHandlerCRUDCommand generate both service and handler CRUD code