package domain import ( "fmt" "time" ) type Order struct { OrderID string CustomerID string Amount float64 CreatedAt time.Time } func (o *Order) Validate() error { if o.OrderID == "" { return fmt.Errorf("order_id is required") } if o.CustomerID == "" { return fmt.Errorf("customer_id is required") } if o.Amount <= 0 { return fmt.Errorf("amount must be positive") } return nil } func (o *Order) NaturalKey() string { return fmt.Sprintf("%s_%s_%d", o.OrderID, o.CustomerID, o.CreatedAt.Unix()) }