create

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameEmpty       = errors.New("please provide a name")
	ErrInvalidType     = errors.New("invalid create type")
	ErrNoProjectName   = errors.New("cannot determine project name, ensure go.mod exists")
	ErrCreateFile      = errors.New("failed to create file")
	ErrExecuteTemplate = errors.New("failed to execute template")
)

Functions

func All

func All(name string) (string, error)

All creates handler, service, repository, and model files.

func CreateComponent added in v0.2.0

func CreateComponent(name, createType string) (string, error)

CreateComponent creates a component file for the given type.

func GetTemplate

func GetTemplate(createType string) string

GetTemplate returns the template content for the given type.

func Handler

func Handler(name string) (string, error)

Handler creates a new handler file.

func Model

func Model(name string) (string, error)

Model creates a new model file.

func Repository

func Repository(name string) (string, error)

Repository creates a new repository file.

func Service

func Service(name string) (string, error)

Service creates a new service file.

Types

type CreateData

type CreateData struct {
	ProjectName          string
	CreateType           string
	FilePath             string
	FileName             string
	StructName           string
	StructNameLowerFirst string
	StructNameSnakeCase  string
}

CreateData holds the data structure for template execution.

Jump to

Keyboard shortcuts

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