Help us shape the future of Go! Take the 2026 Go Developer Survey

generate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTemplateData added in v0.1.4

func BuildTemplateData(cfg ComponentConfig) map[string]any

func Capitalize added in v0.1.4

func Capitalize(s string) string

func DetectProjectProfile added in v0.1.7

func DetectProjectProfile() (*detector.ProjectProfile, error)

func DetectProjectProfileWithRefresh added in v0.1.7

func DetectProjectProfileWithRefresh(forceRefresh bool) (*detector.ProjectProfile, error)

func FindSourcePath added in v0.1.4

func FindSourcePath(startDir string) string

func FindTestPath added in v0.1.7

func FindTestPath(startDir string) string

func FormatRelativePath added in v0.1.4

func FormatRelativePath(base, path string) string

func GenerateComponent added in v0.1.4

func GenerateComponent(cfg ComponentConfig, templateName, subPackage, fileNamePattern string) (bool, error)

func GetTemplateDir added in v0.1.7

func GetTemplateDir(profile *detector.ProjectProfile) string

func GetTestTemplateDir added in v0.1.7

func GetTestTemplateDir(profile *detector.ProjectProfile) string

func IsUpper added in v0.1.4

func IsUpper(r rune) bool

func NewCommand

func NewCommand() *cobra.Command

func OutputGenerateResult added in v0.1.9

func OutputGenerateResult(jsonOutput bool, tracker *GenerateTracker) error

func SplitWords added in v0.1.4

func SplitWords(s string) []string

func ToCamelCase added in v0.1.4

func ToCamelCase(s string) string

func ToPascalCase added in v0.1.4

func ToPascalCase(s string) string

func ValidateComponentConfig added in v0.1.4

func ValidateComponentConfig(cfg ComponentConfig) error

func ValidateComponentName added in v0.1.4

func ValidateComponentName(name string) error

func ValidatePackageName added in v0.1.4

func ValidatePackageName(pkg string) error

Types

type ComponentConfig added in v0.1.4

type ComponentConfig struct {
	Name          string
	BasePackage   string
	HasLombok     bool
	HasJpa        bool
	HasValidation bool
}

func DetectProjectConfig added in v0.1.4

func DetectProjectConfig() (ComponentConfig, error)

func RunComponentWizard added in v0.1.4

func RunComponentWizard(title string, cfg ComponentConfig, componentType string) (ComponentConfig, error)

type GenerateTracker added in v0.1.9

type GenerateTracker struct {
	Type      string
	Name      string
	Generated []string
	Skipped   []string
	Errors    []string
}

func NewGenerateTracker added in v0.1.9

func NewGenerateTracker(componentType, name string) *GenerateTracker

func (*GenerateTracker) AddError added in v0.1.9

func (t *GenerateTracker) AddError(err string)

func (*GenerateTracker) AddGenerated added in v0.1.9

func (t *GenerateTracker) AddGenerated(file string)

func (*GenerateTracker) AddSkipped added in v0.1.9

func (t *GenerateTracker) AddSkipped(file string)

func (*GenerateTracker) ToOutput added in v0.1.9

func (t *GenerateTracker) ToOutput() output.GenerateResult

type ResourceConfig

type ResourceConfig struct {
	Name          string
	BasePackage   string
	HasLombok     bool
	HasJpa        bool
	HasValidation bool
}

type SecurityType added in v0.1.9

type SecurityType string
const (
	SecurityJWT     SecurityType = "jwt"
	SecuritySession SecurityType = "session"
	SecurityOAuth2  SecurityType = "oauth2"
)

type TemplateContext added in v0.1.7

type TemplateContext struct {
	Name      string
	NameLower string
	NameCamel string

	BasePackage    string
	FeaturePackage string
	TestPackage    string

	Architecture     string
	FeatureStyleFlat bool

	HasLombok     bool
	HasJpa        bool
	HasValidation bool
	HasSwagger    bool
	HasMapStruct  bool

	IDType      string
	IDImport    string
	TestIdValue string

	ControllerSuffix string
	RequestSuffix    string
	ResponseSuffix   string

	HasBaseEntity    bool
	BaseEntityName   string
	BaseEntityImport string

	HasResponseWrapper    bool
	ResponseWrapperName   string
	ResponseWrapperImport string

	HasGlobalException bool
	ExceptionPackage   string

	ValidationImport string

	Lombok detector.LombokProfile
}

func BuildTemplateContextFromProfile added in v0.1.7

func BuildTemplateContextFromProfile(name string, profile *detector.ProjectProfile) TemplateContext

func (TemplateContext) ToMap added in v0.1.7

func (ctx TemplateContext) ToMap() map[string]any

Jump to

Keyboard shortcuts

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