cmd

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Copyright © 2023 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 ReadModuleNameFromGoModFile

func ReadModuleNameFromGoModFile() (string, error)

func WriteToFile

func WriteToFile(newFile string, fileData []byte) error

Types

type ActionType

type ActionType int
const (
	ActionCreate ActionType = iota + 1
	ActionUpdate
)

type Generator

type Generator struct {
	Module         string // go.mod module
	TargetFile     string // 写入目标文件
	SnakeName      string
	TmplName       string
	UpdatePosition string       // 更新位置
	Action         ActionType   // 动作;创建,还是更新
	Content        bytes.Buffer // 内容
	WorkDir        string       // exec命令执行工作目录
	InternalDir    string
	ConfigDir      string
	DatabaseDir    string
	HandlerDir     string
	RequestDir     string
	ResponseDir    string
	ModelDir       string
	RepositoryDir  string
	ServiceDir     string
	LogrotateDir   string
	SystemdDir     string
	DocDir         string
	// contains filtered or unexported fields
}

func NewGenerate

func NewGenerate(name string) *Generator

func (*Generator) EntGenerate

func (gen *Generator) EntGenerate() (string, error)

func (*Generator) Generate

func (gen *Generator) Generate(targetFile, tmpl string, actionType ActionType) error

func (*Generator) InitGenerate

func (gen *Generator) InitGenerate(filename, fileDirname, templateName string) error

InitGenerate generate func filename mysql.go fileDirname /internal/database/ templateName mysql.tmpl

func (*Generator) InitHandler

func (gen *Generator) InitHandler() error

func (*Generator) InitInterface

func (gen *Generator) InitInterface(t string) error

InitInterface init interface file

func (*Generator) NewEntSchema

func (gen *Generator) NewEntSchema() (string, error)

func (*Generator) NewHandler

func (gen *Generator) NewHandler() error

func (*Generator) NewRepository

func (gen *Generator) NewRepository() error

func (*Generator) NewRequest

func (gen *Generator) NewRequest() error

func (*Generator) NewResponse

func (gen *Generator) NewResponse() error

func (*Generator) NewRouter

func (gen *Generator) NewRouter() error

func (*Generator) NewService

func (gen *Generator) NewService() error

Jump to

Keyboard shortcuts

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