models

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apply

type Apply struct {
	ID      string `gorm:"primaryKey;type:varchar(20)"`
	StageID string `gorm:"type:varchar(20);uniqueIndex"`

	// Checksums for validation
	BaseDigest  string `gorm:"type:varchar(64)"` // SHA256 of original
	AfterDigest string `gorm:"type:varchar(64)"` // SHA256 of modified

	// Metadata
	AutoApplied bool      `gorm:"default:false"`
	AppliedBy   string    `gorm:"type:varchar(100)"` // User or "auto"
	AppliedAt   time.Time `gorm:"autoCreateTime"`

	// Revert tracking
	Reverted   bool   `gorm:"default:false"`
	RevertedBy string `gorm:"type:varchar(100)"`
	RevertedAt *time.Time

	// Relationship
	Stage Stage `gorm:"foreignKey:StageID"`
}

Apply represents a committed transformation

func (Apply) TableName

func (Apply) TableName() string

type Session

type Session struct {
	ID        string    `gorm:"primaryKey;type:varchar(20)"`
	StartedAt time.Time `gorm:"autoCreateTime"`
	EndedAt   *time.Time

	// Statistics
	StagesCount  int `gorm:"default:0"`
	AppliesCount int `gorm:"default:0"`

	// Client info
	ClientInfo datatypes.JSON `gorm:"type:jsonb"`
}

Session tracks a complete Morfx transformation session

func (Session) TableName

func (Session) TableName() string

type Stage

type Stage struct {
	ID        string `gorm:"primaryKey;type:varchar(20)"`
	SessionID string `gorm:"type:varchar(20);index"`

	// Operation details
	Language  string `gorm:"type:varchar(50);not null"`
	Operation string `gorm:"type:varchar(20);not null"` // query, replace, delete, etc

	// Target information
	TargetType  string         `gorm:"type:varchar(50)"`  // function, struct, class
	TargetName  string         `gorm:"type:varchar(255)"` // name pattern
	TargetQuery datatypes.JSON `gorm:"type:jsonb"`        // full query object

	// Content
	Original string `gorm:"type:text"`
	Modified string `gorm:"type:text"`
	Content  string `gorm:"type:text"` // For insert operations
	Diff     string `gorm:"type:text"`

	// Checksums for validation
	BaseDigest  string `gorm:"type:varchar(64)"` // SHA256 of original
	AfterDigest string `gorm:"type:varchar(64)"` // SHA256 of modified

	// Confidence scoring
	ConfidenceScore   float64        `gorm:"type:decimal(3,2)"`
	ConfidenceLevel   string         `gorm:"type:varchar(10)"`
	ConfidenceFactors datatypes.JSON `gorm:"type:jsonb"`

	// Scope AST for advanced operations
	ScopeAST datatypes.JSON `gorm:"type:jsonb"`

	// Status tracking
	Status    string    `gorm:"type:varchar(20);default:'pending'"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	ExpiresAt time.Time `gorm:"index"`
	AppliedAt *time.Time

	// Relationships
	Apply *Apply `gorm:"foreignKey:StageID"`
}

Stage represents a pending code transformation

func (Stage) TableName

func (Stage) TableName() string

TableName customizations for cleaner names

Jump to

Keyboard shortcuts

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