Documentation
¶
Index ¶
- type FieldDefinition
- type ParsedStormTag
- type StormTagParser
- type StructParser
- type TableDefinition
- type TagParser
- func (p *TagParser) GetArrayType(attributes map[string]string) string
- func (p *TagParser) GetDefault(attributes map[string]string) string
- func (p *TagParser) GetEnum(attributes map[string]string) []string
- func (p *TagParser) GetForeignKey(attributes map[string]string) string
- func (p *TagParser) GetPrevName(attributes map[string]string) string
- func (p *TagParser) GetType(attributes map[string]string) string
- func (p *TagParser) HasFlag(attributes map[string]string, flag string) bool
- func (p *TagParser) ParseDBDefTag(tagValue string) map[string]string
- func (p *TagParser) ValidateDBDefTag(tagValue string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldDefinition ¶
type FieldDefinition struct {
Name string
DBName string
Type string
IsPointer bool
IsArray bool
DBDef map[string]string
DBTag string
DBDefTag string // Deprecated: use StormTag instead
JSONTag string
ORMTag string // Deprecated: use StormTag instead
StormTag string // New unified tag
}
FieldDefinition represents a struct field with database metadata
type ParsedStormTag ¶
type ParsedStormTag struct {
// Column attributes (from previous dbdef)
Type string
PrimaryKey bool
NotNull bool
Unique bool
Default string
Check string
ForeignKey string
OnDelete string
OnUpdate string
Constraint string
Prev string
Enum []string
ArrayType string
// Relationship attributes (from previous orm)
RelationType string // "belongs_to", "has_one", "has_many", "has_many_through"
RelationTarget string // Target model/table name
RelationForeignKey string // Foreign key column
RelationSourceKey string // Source key column (for has_many)
RelationTargetKey string // Target key column (for belongs_to)
JoinTable string // Join table for has_many_through
SourceFK string // Source FK in join table
TargetFK string // Target FK in join table
Conditions []string // Additional conditions
OrderBy string // Default ordering
Dependent string // Dependent action (destroy, delete, nullify)
Inverse string // Inverse relationship name
Polymorphic string // Polymorphic association
Through string // Through association
Validate bool // Whether to validate association
Autosave bool // Whether to autosave association
Counter string // Counter cache column
// Special attributes
Column string // Database column name (replaces db tag for relationships)
Ignore bool // Exclude from database operations
Computed string // Computed/derived field
Immutable bool // Immutable field (create-only)
// Table-level attributes (for _ struct{} fields)
Table string // Table name
Indexes []string // Index definitions
UniqueIndexes []string // Unique constraints
// Raw tag value
Raw string
// Context - whether this is a column or relationship field
IsRelationship bool
}
ParsedStormTag represents a parsed storm tag that can contain both column and relationship attributes
func (*ParsedStormTag) ToDBDefAttributes ¶
func (p *ParsedStormTag) ToDBDefAttributes() map[string]string
func (*ParsedStormTag) ToTableLevelAttributes ¶
func (p *ParsedStormTag) ToTableLevelAttributes() map[string]string
type StormTagParser ¶
type StormTagParser struct {
// contains filtered or unexported fields
}
StormTagParser handles parsing of unified storm tags
func NewStormTagParser ¶
func NewStormTagParser() *StormTagParser
func (*StormTagParser) ParseStormTag ¶
func (p *StormTagParser) ParseStormTag(tag string, isRelationshipField bool) (*ParsedStormTag, error)
type StructParser ¶
type StructParser struct {
// contains filtered or unexported fields
}
StructParser handles parsing Go struct definitions
func NewStructParser ¶
func NewStructParser() *StructParser
func (*StructParser) ParseDirectory ¶
func (p *StructParser) ParseDirectory(dir string) ([]TableDefinition, error)
func (*StructParser) ParseFile ¶
func (p *StructParser) ParseFile(filename string) ([]TableDefinition, error)
type TableDefinition ¶
type TableDefinition struct {
StructName string
TableName string
Fields []FieldDefinition
TableLevel map[string]string
}
TableDefinition represents a complete table structure
type TagParser ¶
type TagParser struct{}
TagParser handles parsing of dbdef struct tags
func NewTagParser ¶
func NewTagParser() *TagParser
func (*TagParser) GetArrayType ¶
func (*TagParser) GetForeignKey ¶
func (*TagParser) GetPrevName ¶
func (*TagParser) ParseDBDefTag ¶
func (*TagParser) ValidateDBDefTag ¶
Click to show internal directories.
Click to hide internal directories.