gogen

package
v1.6.10-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2023 License: GPL-3.0 Imports: 36 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// VarStringDir describes the directory.
	VarStringDir string
	// VarStringAPI describes the API.
	VarStringAPI string
	// VarStringHome describes the go home.
	VarStringHome string
	// VarStringRemote describes the remote git repository.
	VarStringRemote string
	// VarStringBranch describes the branch.
	VarStringBranch string
	// VarStringStyle describes the style of output files.
	VarStringStyle string
	// VarBoolErrorTranslate describes whether to translate error
	VarBoolErrorTranslate bool
	// VarBoolUseCasbin describe whether to use Casbin
	VarBoolUseCasbin bool
	// VarBoolUseI18n describe whether to use i18n
	VarBoolUseI18n bool
	// VarStringProto describe the proto file path
	VarStringProto string
	// VarStringAPIServiceName describe the API service name
	VarStringAPIServiceName string
	// VarStringRPCServiceName describe the RPC service name
	VarStringRPCServiceName string
	// VarStringModelName describe which model for generating
	VarStringModelName string
	// VarIntSearchKeyNum describe the number of search keys
	VarIntSearchKeyNum int
	// VarStringOutput describes the output.
	VarStringOutput string
	// VarStringRpcName describes the rpc name in service context
	VarStringRpcName string
	// VarStringGrpcPbPackage describes the grpc package
	VarStringGrpcPbPackage string
	// VarBoolMultiple describes whether the proto contains multiple services
	VarBoolMultiple bool
	// VarStringJSONStyle describes the JSON tag format.
	VarStringJSONStyle string
	// VarBoolOverwrite describes whether to overwrite the files, it will overwrite all generated files.
	VarBoolOverwrite bool
	// VarStringSchema describes the ent schema path
	VarStringSchema string
	// VarStringGroupName describes whether to use group
	VarStringGroupName string
	// VarStringImportPrefix describes the prefix in import
	VarStringImportPrefix string
	// VarStringExtraField describes the extra field for api logic code such as user id
	VarStringExtraField string
	// VarBoolDisabledValidator describes whether to disable validator
	VarBoolDisabledValidator bool
	// VarBoolOptionalService describes whether to generate for optional service
	VarBoolOptionalService bool
)

Functions

func BuildTypes

func BuildTypes(types []spec.Type, config *config.Config) (string, error)

BuildTypes gen types to string

func Category

func Category() string

Category returns the category of the api files.

func Clean

func Clean() error

Clean cleans the generated deployment files.

func ConvertRoutePathToSwagger

func ConvertRoutePathToSwagger(data string) string

ConvertRoutePathToSwagger converts route path to swagger format.

func DoGenProject

func DoGenProject(apiFile, dir, style string, g *GenContext) error

DoGenProject gen go project files with api file

func GenCRUDLogicByEnt

func GenCRUDLogicByEnt(_ *cobra.Command, _ []string) error

func GenCRUDLogicByProto

func GenCRUDLogicByProto(_ *cobra.Command, _ []string) error

func GenEntTx

func GenEntTx(dir, style, rootPkg string) error

func GenErrorHandler

func GenErrorHandler(dir, style, rootPkg string) error

func GenTemplates

func GenTemplates() error

GenTemplates generates api enttemplate files.

func GoCommand

func GoCommand(_ *cobra.Command, _ []string) error

GoCommand gen go project files from command line

func RevertTemplate

func RevertTemplate(name string) error

RevertTemplate reverts the given enttemplate file to the default value.

func Update

func Update() error

Update updates the enttemplate files to the templates built in current goctl.

Types

type GenContext

type GenContext struct {
	UseCasbin     bool
	UseI18n       bool
	TransErr      bool
	ModuleName    string
	Port          int
	UseMakefile   bool
	UseDockerfile bool
	ImportPrefix  string
	UseEnt        bool
	ExtraField    string
	IsNewProject  bool
	UseValidator  bool
}

GenContext describes the data used for api file generation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL