generators

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s, substr string) bool

Contains is a wrapper for strings.Contains

func GenerateAddModal

func GenerateAddModal(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateAddModal generates the Add{EntityName}Modal.vue component for an entity

func GenerateComposable

func GenerateComposable(baseDir, composablesDir, entityName, pluralName string, fields []Field) error

GenerateComposable generates the composable for an entity

func GenerateDeleteModal

func GenerateDeleteModal(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateDeleteModal generates the Delete{EntityName}Modal component for an entity

func GenerateEditModal

func GenerateEditModal(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateEditModal generates the Edit{EntityName}Modal component for an entity

func GenerateEntityStore

func GenerateEntityStore(baseDir, storesDir, entityName, pluralName string, fields []Field) error

GenerateEntityStore generates the entityStore.ts file for an entity

func GenerateEntityType

func GenerateEntityType(baseDir, storesDir, entityName, pluralName string, fields []Field) error

GenerateEntityType generates the entity.ts file with the TypeScript interface

func GenerateGrid

func GenerateGrid(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateGrid generates the {EntityName}Grid component for an entity

func GenerateGridCard

func GenerateGridCard(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateGridCard generates the {EntityName}GridCard component for an entity

func GenerateNuxtConfig

func GenerateNuxtConfig(baseDir, rootDir, entityName, pluralName string, fields []Field) error

GenerateNuxtConfig generates the nuxt.config.ts file

func GeneratePage

func GeneratePage(baseDir, pagesDir, entityName, pluralName string, fields []Field) error

GeneratePage generates the page for an entity

func GenerateService

func GenerateService(baseDir, servicesDir, entityName, pluralName string, fields []Field) error

GenerateService generates the service for an entity

func GenerateSinglePage

func GenerateSinglePage(baseDir, pagesDir, entityName, pluralName string, fields []Field) error

GenerateSinglePage generates the page for an entity with dynamic routing

func GenerateTable

func GenerateTable(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateTable generates the {EntityName}Table component for an entity

func GenerateViewModal

func GenerateViewModal(baseDir, componentsDir, entityName, pluralName string, fields []Field) error

GenerateViewModal generates the View{EntityName}Modal component for an entity

func PluralizeEntityName

func PluralizeEntityName(name string) string

PluralizeEntityName converts a singular name to its plural form while preserving case

func RemoveFromSidebar

func RemoveFromSidebar(baseDir, pluralName string) error

RemoveFromSidebar removes a navigation item from TheSidebar.vue for the destroyed entity

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase converts a string to camelCase

func ToKebabCase

func ToKebabCase(s string) string

ToKebabCase converts a string to kebab-case

func ToLower

func ToLower(s string) string

ToLower is a wrapper for strings.ToLower

func ToPascalCase

func ToPascalCase(s string) string

ToPascalCase converts a string to PascalCase while preserving internal word boundaries

func ToPlural

func ToPlural(s string) string

ToPlural converts a singular string to its plural form

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase converts a string to snake_case

func ToUpper

func ToUpper(s string) string

ToUpper is a wrapper for strings.ToUpper

func UpdateMainNuxtConfig

func UpdateMainNuxtConfig(baseDir string, entityDirName string) error

UpdateMainNuxtConfig updates the main nuxt.config.ts file to include the new entity

func UpdateSidebar

func UpdateSidebar(baseDir, entityName, pluralName string) error

UpdateSidebar adds a new navigation item to TheSidebar.vue for the generated entity

Types

type Field

type Field struct {
	Name       string
	Type       string
	JSONName   string
	IsRequired bool
}

Field represents a struct field in the entity

func ParseFields

func ParseFields(fieldStrs []string) []Field

ParseFields parses a slice of field strings into Field structs

type Generator

type Generator struct {
	BaseDir    string
	StructName string
	PluralName string
	Fields     []Field
}

Generator holds configuration for the entity generation process

func NewGenerator

func NewGenerator(baseDir, entityName string, fieldStrs []string) *Generator

NewGenerator creates a new generator instance

func (*Generator) Generate

func (g *Generator) Generate() error

Generate creates all entity files from templates

Jump to

Keyboard shortcuts

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