Documentation
¶
Index ¶
- Variables
- func AddImport(content []byte, importStr string) ([]byte, bool)
- func AddModuleInitializer(content []byte, packageName, singularName string) ([]byte, bool)
- func GenerateAirFileFromTemplate(dir string) error
- func GenerateFileFromTemplate(dir, filename, templateName, structName, pluralName, packageName string, ...)
- func GetGoType(t string) string
- func GetRequiredImports(fields []FieldStruct) map[string][]string
- func HasFieldType(fields []FieldStruct, fieldType string) bool
- func HasImageField(fields []FieldStruct) bool
- func RemoveImport(content []byte, importStr string) []byte
- func RemoveModuleInitializer(content []byte, pluralName string) []byte
- func ToCamelCase(s string) string
- func ToKebabCase(s string) string
- func ToLower(s string) string
- func ToLowerPlural(s string) string
- func ToPascalCase(s string) string
- func ToPlural(s string) string
- func ToSnakeCase(s string) string
- func ToTitle(s string) string
- func Unzip(src, dest string) error
- func UpdateInitFile(singularName, pluralName string) error
- func UpdateInitFileForDestroy(singularName string) error
- func UpdateInitGo(packageName, structName string) error
- type FieldStruct
Constants ¶
This section is empty.
Variables ¶
View Source
var PluralizeClient *pluralize.Client
Functions ¶
func AddModuleInitializer ¶
func GenerateAirFileFromTemplate ¶
GenerateAirFileFromTemplate generates the air.toml configuration file from template
func GenerateFileFromTemplate ¶
func GenerateFileFromTemplate(dir, filename, templateName, structName, pluralName, packageName string, fields []FieldStruct)
GenerateFileFromTemplate generates a file from a template
func GetRequiredImports ¶
func GetRequiredImports(fields []FieldStruct) map[string][]string
func HasFieldType ¶
func HasFieldType(fields []FieldStruct, fieldType string) bool
HasFieldType checks if any field has the specified type
func HasImageField ¶
func HasImageField(fields []FieldStruct) bool
HasImageField checks if any field has the image type
func RemoveImport ¶
func RemoveModuleInitializer ¶
func ToCamelCase ¶
func ToKebabCase ¶
func ToLowerPlural ¶
func ToPascalCase ¶
func ToSnakeCase ¶
func UpdateInitFile ¶
func UpdateInitGo ¶
UpdateInitGo adds the module initialization to init.go
Types ¶
type FieldStruct ¶
type FieldStruct struct { Name string Type string JSONName string DBName string AssociatedType string AssociatedTable string PluralType string Relationship string RelatedModel string IsRequired bool GORM string // Add this field for GORM tags }
FieldStruct represents a field in the model
func GenerateFieldStructs ¶
func GenerateFieldStructs(fields []string) []FieldStruct
GenerateFieldStructs processes all fields and returns a slice of FieldStruct
func ProcessField ¶ added in v1.1.3
func ProcessField(fieldDef string) []FieldStruct
Click to show internal directories.
Click to hide internal directories.