Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldsToGoStruct ¶
FieldsToGoStruct generates Go struct field declarations
func FieldsToSQLColumns ¶
FieldsToSQLColumns generates SQL column definitions
Types ¶
type Field ¶
type Field struct {
Name string
Type string
GoType string
SQLType string
IsReference bool
ReferencedTable string
OnDelete string // CASCADE, SET NULL, RESTRICT, etc.
IsTextarea bool // true if field should render as textarea
IsSelect bool // true if field should render as <select>
SelectOptions []string // options for select fields
IsFile bool // true if field is a file upload
IsImage bool // true if field is an image upload (subset of file)
Metadata FieldMetadata
}
func ParseFields ¶
ParseFields parses field definitions in the format "name:type name2:type2"
type FieldMetadata ¶
type FieldMetadata struct {
ValidateTag string // e.g. "required,email", "required,min=8"
HTMLInputType string // e.g. "email", "url", "tel", "password", "text", "number"
HTMLMinLength int // 0 = not set
HTMLMaxLength int // 0 = not set
HTMLStep string // e.g. "0.01" for floats
IsPassword bool // suppress value echo in edit forms
}
FieldMetadata holds validation and HTML rendering metadata derived from the field type.
func GetFieldMetadata ¶
func GetFieldMetadata(fieldType string) FieldMetadata
GetFieldMetadata returns validation and HTML metadata for a given field type.
Click to show internal directories.
Click to hide internal directories.