package entity import ( "time" ) // Workspace 工作空间实体 type Workspace struct { ID string Name string Description string ClusterIDs []string // 关联的集群 ID 列表 CreatedBy string // 创建者用户 ID CreatedAt time.Time UpdatedAt time.Time } // NewWorkspace 创建新工作空间 func NewWorkspace(name, description, createdBy string, clusterIDs []string) *Workspace { now := time.Now() return &Workspace{ Name: name, Description: description, ClusterIDs: clusterIDs, CreatedBy: createdBy, CreatedAt: now, UpdatedAt: now, } } // Validate 验证工作空间数据 func (w *Workspace) Validate() error { if w.Name == "" { return ErrInvalidWorkspaceName } return nil }