generator

package
v0.0.0-...-ce5851c Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeneratorCmd = &cobra.Command{
	Use:              "generator",
	Short:            "haruka code generator",
	TraverseChildren: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		if ModelType == "project" {
			err := NewProject(newProjectOption{
				Name: PkgName,
			})
			if err != nil {
				return err
			}
		}
		if len(ModelName) > 0 && ModelType == "rest" {
			err := GenerateRestModel(ModelName)
			if err != nil {
				return err
			}
		}
		return nil
	},
}
View Source
var ModelName string
View Source
var ModelType string
View Source
var PkgName string

Functions

func GenerateRestModel

func GenerateRestModel(modelName string) error

func NewProject

func NewProject(option newProjectOption) error

Types

type GoTemplate

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

func NewGoTemplate

func NewGoTemplate(output string) *GoTemplate

func (*GoTemplate) AddVar

func (t *GoTemplate) AddVar(key string, data interface{}) *GoTemplate

func (*GoTemplate) AddVars

func (t *GoTemplate) AddVars(vars map[string]interface{}) *GoTemplate

func (*GoTemplate) GenerateCode

func (t *GoTemplate) GenerateCode() (err error)

func (*GoTemplate) LoadTemplate

func (t *GoTemplate) LoadTemplate(templateString string) *GoTemplate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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