Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditLog ¶
type AuditLog struct {
ID uint `gorm:"primarykey" json:"id"`
UserID uuid.UUID `gorm:"type:text;index" json:"user_id"`
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
Action string `gorm:"not null" json:"action"` // e.g., "create_workspace", "grant_permission"
Resource string `gorm:"not null" json:"resource"` // e.g., "workspace:123", "user:456"
DetailsJSON string `gorm:"type:text" json:"details_json"` // Additional context in JSON
Timestamp time.Time `gorm:"not null;index" json:"timestamp"`
}
AuditLog represents a record of user actions for compliance
type Job ¶
type Job struct {
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
WorkspaceID uuid.UUID `gorm:"type:text;index" json:"workspace_id"`
Workspace Workspace `gorm:"foreignKey:WorkspaceID" json:"workspace,omitempty"`
Type JobType `gorm:"not null" json:"type"`
Status JobStatus `gorm:"not null;default:'pending'" json:"status"`
Logs string `gorm:"type:text" json:"logs"`
Error string `gorm:"type:text" json:"error,omitempty"`
Metadata map[string]interface{} `gorm:"serializer:json" json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
Job represents a background task
type OCIRegistry ¶
type OCIRegistry struct {
ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
Name string `gorm:"uniqueIndex;not null" json:"name"` // e.g., "GitHub Container Registry"
URL string `gorm:"not null" json:"url"` // e.g., "ghcr.io"
Username string `json:"username"`
Password string `json:"-"` // encrypted, never exposed in JSON
APIToken string `json:"-"` // API token for registry REST API (e.g. Quay.io), never exposed in JSON
IsDefault bool `gorm:"default:false" json:"is_default"`
Namespace string `json:"namespace"` // e.g., "nebari_environments" - organization or namespace on the registry
CreatedBy uuid.UUID `gorm:"type:uuid" json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `gorm:"index" json:"-"`
}
OCIRegistry represents an OCI-compliant container registry
func (*OCIRegistry) BeforeCreate ¶
func (r *OCIRegistry) BeforeCreate(tx *gorm.DB) error
BeforeCreate will set a UUID rather than numeric ID
func (OCIRegistry) TableName ¶
func (OCIRegistry) TableName() string
TableName specifies the table name for OCIRegistry
type Package ¶
type Package struct {
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
WorkspaceID uuid.UUID `gorm:"type:text;not null;index" json:"workspace_id"`
Workspace Workspace `gorm:"foreignKey:WorkspaceID" json:"workspace,omitempty"`
Name string `gorm:"not null" json:"name"`
Version string `json:"version"`
InstalledAt time.Time `json:"installed_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
Package represents an installed package in a workspace
type Permission ¶
type Permission struct {
ID uint `gorm:"primarykey" json:"id"`
UserID uuid.UUID `gorm:"type:text;not null;index" json:"user_id"`
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
WorkspaceID uuid.UUID `gorm:"type:text;not null;index" json:"workspace_id"`
Workspace Workspace `gorm:"foreignKey:WorkspaceID" json:"workspace,omitempty"`
RoleID uint `gorm:"not null" json:"role_id"`
Role Role `gorm:"foreignKey:RoleID" json:"role,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
Permission represents user access to a workspace
type Publication ¶
type Publication struct {
ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
WorkspaceID uuid.UUID `gorm:"type:uuid;index;not null" json:"workspace_id"`
Workspace Workspace `gorm:"foreignKey:WorkspaceID" json:"workspace,omitempty"`
VersionNumber int `gorm:"not null" json:"version_number"` // Which version was published
RegistryID uuid.UUID `gorm:"type:uuid;index;not null" json:"registry_id"`
Registry OCIRegistry `gorm:"foreignKey:RegistryID" json:"registry,omitempty"`
Repository string `gorm:"not null" json:"repository"` // e.g., "myorg/myenv"
Tag string `gorm:"not null" json:"tag"` // e.g., "v1.0.0"
Digest string `json:"digest"` // OCI manifest digest
IsPublic bool `gorm:"default:false" json:"is_public"`
PublishedBy uuid.UUID `gorm:"type:uuid;not null" json:"published_by"`
PublishedByUser User `gorm:"foreignKey:PublishedBy" json:"published_by_user,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `gorm:"index" json:"-"`
}
Publication tracks when and where a workspace was published
func (*Publication) BeforeCreate ¶
func (p *Publication) BeforeCreate(tx *gorm.DB) error
BeforeCreate will set a UUID rather than numeric ID
func (Publication) TableName ¶
func (Publication) TableName() string
TableName specifies the table name for Publication
type Role ¶
type Role struct {
ID uint `gorm:"primarykey" json:"id"`
Name string `gorm:"uniqueIndex;not null" json:"name"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
Role represents a user role (admin, owner, editor, viewer)
type Template ¶
type Template struct {
ID uint `gorm:"primarykey" json:"id"`
Name string `gorm:"uniqueIndex;not null" json:"name"`
Description string `json:"description"`
ConfigJSON string `gorm:"type:text;not null" json:"config_json"` // JSON config for workspace
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
Template represents a pre-configured workspace template
type User ¶
type User struct {
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
Username string `gorm:"uniqueIndex;not null" json:"username"`
PasswordHash string `gorm:"not null" json:"-"`
Email string `gorm:"uniqueIndex;not null" json:"email"`
AvatarURL string `json:"avatar_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
User represents a system user
type Workspace ¶
type Workspace struct {
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
Name string `gorm:"not null" json:"name"`
OwnerID uuid.UUID `gorm:"type:text;index" json:"owner_id"`
Owner User `gorm:"foreignKey:OwnerID" json:"owner,omitempty"`
Status WorkspaceStatus `gorm:"not null;default:'pending'" json:"status"`
PackageManager string `gorm:"not null" json:"package_manager"` // "pixi" or "uv"
Source string `gorm:"default:'managed'" json:"source"` // "managed", "local"
Path string `json:"path,omitempty"` // filesystem path (local-mode)
SizeBytes int64 `gorm:"default:0" json:"size_bytes"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
Workspace represents a package manager workspace
func (*Workspace) BeforeCreate ¶
BeforeCreate hook to generate UUID
type WorkspaceStatus ¶
type WorkspaceStatus string
WorkspaceStatus represents the state of a workspace
const ( WsStatusPending WorkspaceStatus = "pending" WsStatusCreating WorkspaceStatus = "creating" WsStatusReady WorkspaceStatus = "ready" WsStatusFailed WorkspaceStatus = "failed" WsStatusDeleting WorkspaceStatus = "deleting" )
type WorkspaceTag ¶
type WorkspaceTag struct {
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
WorkspaceID uuid.UUID `gorm:"type:text;not null;uniqueIndex:idx_ws_tag" json:"workspace_id"`
Workspace *Workspace `gorm:"foreignKey:WorkspaceID" json:"workspace,omitempty"`
Tag string `gorm:"not null;uniqueIndex:idx_ws_tag" json:"tag"`
VersionNumber int `gorm:"not null" json:"version_number"`
CreatedBy uuid.UUID `gorm:"type:text;not null" json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WorkspaceTag represents a named pointer to a specific version of a workspace. Tags are mutable — pushing the same tag again re-points it to the new version.
func (*WorkspaceTag) BeforeCreate ¶
func (wt *WorkspaceTag) BeforeCreate(tx *gorm.DB) error
BeforeCreate hook to generate UUID
type WorkspaceVersion ¶
type WorkspaceVersion struct {
ID uuid.UUID `gorm:"type:text;primary_key" json:"id"`
WorkspaceID uuid.UUID `gorm:"type:text;not null;index:idx_ws_version" json:"workspace_id"`
Workspace *Workspace `gorm:"foreignKey:WorkspaceID" json:"workspace,omitempty"`
// Version tracking
VersionNumber int `gorm:"not null;index:idx_ws_version" json:"version_number"` // Auto-incrementing per workspace
// File contents (stored as TEXT in database)
LockFileContent string `gorm:"type:text;not null" json:"lock_file_content"` // pixi.lock content
ManifestContent string `gorm:"type:text;not null" json:"manifest_content"` // pixi.toml content
PackageMetadata string `gorm:"type:text;not null" json:"package_metadata"` // JSON of package list
// Content hash for deduplication
ContentHash string `gorm:"type:text;index" json:"content_hash"`
// Context
JobID *uuid.UUID `gorm:"type:text;index" json:"job_id,omitempty"` // Job that triggered this version
Job *Job `gorm:"foreignKey:JobID" json:"job,omitempty"`
CreatedBy uuid.UUID `gorm:"type:text;not null" json:"created_by"` // User who triggered the change
CreatedByUser *User `gorm:"foreignKey:CreatedBy" json:"created_by_user,omitempty"`
Description string `gorm:"type:text" json:"description,omitempty"` // Optional description of changes
// Timestamps
CreatedAt time.Time `json:"created_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
WorkspaceVersion represents a snapshot of workspace files at a point in time
func (*WorkspaceVersion) BeforeCreate ¶
func (wv *WorkspaceVersion) BeforeCreate(tx *gorm.DB) error
BeforeCreate hook to generate UUID and version number