cmd

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIndentForNewFunc added in v0.1.8

func CreateIndentForNewFunc(fnIdent *ast.Ident, entClient string, structType *ast.TypeSpec,
	paramTypeName string) (*ast.Ident, *ast.Ident, *ast.Ident, *ast.Ident, *ast.Ident, *ast.Ident,
	*ast.Ident, *ast.Ident, *ast.Ident, *ast.Ident, *ast.Ident, *ast.Ident,
)

func CreateOneFactory added in v0.0.8

func CreateOneFactory(realPath, schemaName, realOutPutPath string, flags GenFlags)

CreateOneFactory create one factory.

func CreatePathAndCommonFile added in v0.0.6

func CreatePathAndCommonFile(commonPath string, outputPath string)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ExtraNameFromSchemaFilePath added in v0.1.0

func ExtraNameFromSchemaFilePath(schemaFile string) string

func Fatal

func Fatal(msg string)

func Fatalf

func Fatalf(format string, v ...interface{})

func GenerateFactories

func GenerateFactories(cmd *cobra.Command, _ []string)

GenerateFactories generates factory files for a given schema.

func GenerateFactoryForOneFile added in v0.1.8

func GenerateFactoryForOneFile(flags GenFlags)

GenerateFactoryForOneFile only for one model file.

func GenerateSetValueFunc added in v0.1.10

func GenerateSetValueFunc(field *ast.Field, skipStructFields map[string]struct{}, setValueParam SetValueParam) string

func GenerateWithFunc added in v0.1.10

func GenerateWithFunc(params GenerateWithFuncParams) int

func GetRealPathAndFilePath added in v0.1.0

func GetRealPathAndFilePath(schemaPath string, v os.FileInfo, outputPath string) (string, string)

func ImportFieldFunc added in v0.1.11

func ImportFieldFunc(
	structType *ast.StructType,
	ignoreEmbedded bool,
	genImported bool,
	importFields []string,
) []string

func NewFunc added in v0.1.1

func NewFunc(params NewFuncParams) error

NewFunc Create the New instance function. todo 85 lines of code (exceeds 50 allowed).

func RunGenerate

func RunGenerate(schemaFile, schemaTypeName, outputPath string, flags GenFlags) (io.Reader, error)

RunGenerate ===== generate one factory schema =======.

Types

type GenFlags added in v0.1.9

type GenFlags struct {
	SchemaFile      string
	SchemaPath      string
	OutputPath      string
	ProjectPath     string
	Overwrite       bool
	FactoriesPath   string
	AppPath         string
	EntClientName   string
	ModelPath       string
	GenImportFields bool
}

func ExtraFlags

func ExtraFlags(cmd *cobra.Command) GenFlags

type GenerateWithFuncParams added in v0.1.11

type GenerateWithFuncParams struct {
	AstOut                *ast.File
	StructType            *ast.TypeSpec
	FnIdent               *ast.Ident
	FnParamType           *ast.StarExpr
	GenerateForUnexported bool
	Field                 *ast.Field
	SkipStructFields      map[string]struct{}
	NumFnsAdded           int
}

type NewFuncParams added in v0.1.11

type NewFuncParams struct {
	AstOut                *ast.File
	ParamTypeName         string
	StructType            *ast.TypeSpec
	FnIdent               *ast.Ident
	FnParamType           *ast.StarExpr
	GenerateForUnexported bool
	IgnoreUnsupported     bool
	SkipStructFields      map[string]struct{}
	EntClient             string
	GenImportFields       bool
}

type SetValueParam added in v0.1.11

type SetValueParam struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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