Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFile ¶
Types ¶
type GenConfig ¶
type GenConfig struct {
OutPath string
IncludeStructs []string
ExcludeStructs []string
FieldTypeMap map[string]string
}
GenConfig holds parsed configuration from config.go
func ParseConfig ¶
ParseConfig parses config.go in the given directory for gen.Config
type JSONFieldMeta ¶
type JSONFieldMeta struct {
FieldName string // Name of the field in parent model (e.g. "Metadata")
TypeName string // Name of the JSON struct type (e.g. "UserMetadata")
ColumnName string // Database column name
Paths []JSONPathMeta // List of paths in this JSON field
}
JSONFieldMeta holds information about a JSON field's path structure
type JSONPathMeta ¶
type JSONPathMeta struct {
GoName string // Go field name (e.g. "Name")
JSONPath string // JSON path (e.g. "$.name")
}
JSONPathMeta holds information about a single JSON path
type ModelMeta ¶
type ModelMeta struct {
PackageName string
ParentPackage string // For generated code to reference parent package
ModulePath string // Module path like github.com/user/project
PackagePath string // Package path like models
ModelName string
TableName string
Fields []FieldMeta
JSONFields []JSONFieldMeta // JSON field path definitions
Doc []string // Documentation comments
GeneratedAt string // Timestamp
HasJSON bool // Whether imported encoding/json package is needed
HasJSONField bool // Whether any field has type:json tag
PKFieldName string // Cached PK Field Name
PKColumnName string // Cached PK Column Name
PKFieldType string // Cached PK Field Type
IsAutoIncrementPK bool // Cached PK AutoIncrement status
SchemaStructName string // e.g. userSchema
IsJSONOnly bool // True if struct is only used as JSON embed (no db tags/PK)
HasDBTag bool // True if any field has a db tag
TypeAliases map[string]string // type A int → {"A": "int"}
FieldTypeMap map[string]string // User-defined type mappings from config
}
func ParseModels ¶
func (ModelMeta) GetFieldType ¶
GetFieldType returns the appropriate field type based on Go type
func (ModelMeta) GoIsNonZero ¶
GoIsNonZero returns the Go expression to check if a field is NOT zero value
func (ModelMeta) QualifyPKType ¶
QualifyPKType returns the qualified type name for the PK field
Click to show internal directories.
Click to hide internal directories.