Files
yuan-lab-llm--clawmanager/backend/internal/models/instance.go
T
River d5398ee671 feat(instance): support fractional CPU cores in instance creation
- Change cpu_cores from int to float64 in backend models, handlers, services
- Update frontend CreateInstancePage to accept decimal CPU values (step 0.1)
- Add DB migration 009_cpu_cores_decimal.sql for DECIMAL(10,2) columns
- Update deployment manifests (k8s, k3s, incluster) schema definitions
- Add GOFLAGS/GOPROXY/GOSUMDB build args to Dockerfile so that
  --build-arg values passed by build scripts take effect during go mod download
2026-04-14 15:21:56 +08:00

44 lines
2.4 KiB
Go

package models
import (
"time"
)
// Instance represents a virtual desktop instance
type Instance struct {
ID int `db:"id,primarykey,autoincrement" json:"id"`
UserID int `db:"user_id" json:"user_id"`
Name string `db:"name" json:"name"`
Description *string `db:"description" json:"description,omitempty"`
Type string `db:"type" json:"type"`
Status string `db:"status" json:"status"`
CPUCores float64 `db:"cpu_cores" json:"cpu_cores"`
MemoryGB int `db:"memory_gb" json:"memory_gb"`
DiskGB int `db:"disk_gb" json:"disk_gb"`
GPUEnabled bool `db:"gpu_enabled" json:"gpu_enabled"`
GPUType *string `db:"gpu_type" json:"gpu_type,omitempty"`
GPUCount int `db:"gpu_count" json:"gpu_count"`
OSType string `db:"os_type" json:"os_type"`
OSVersion string `db:"os_version" json:"os_version"`
ImageRegistry *string `db:"image_registry" json:"image_registry,omitempty"`
ImageTag *string `db:"image_tag" json:"image_tag,omitempty"`
StorageClass string `db:"storage_class" json:"storage_class"`
MountPath string `db:"mount_path" json:"mount_path"`
PodName *string `db:"pod_name" json:"pod_name,omitempty"`
PodNamespace *string `db:"pod_namespace" json:"pod_namespace,omitempty"`
PodIP *string `db:"pod_ip" json:"pod_ip,omitempty"`
AccessURL *string `db:"access_url" json:"access_url,omitempty"`
AccessToken *string `db:"access_token" json:"-"`
AgentBootstrapToken *string `db:"agent_bootstrap_token" json:"-"`
OpenClawConfigSnapshotID *int `db:"openclaw_config_snapshot_id" json:"openclaw_config_snapshot_id,omitempty"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
StartedAt *time.Time `db:"started_at" json:"started_at,omitempty"`
StoppedAt *time.Time `db:"stopped_at" json:"stopped_at,omitempty"`
}
// TableName returns the table name for the Instance model
func (i Instance) TableName() string {
return "instances"
}