Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheTypeRerunAll                          = 1
	CacheTypeReuseExistingNode                 = 2
	CacheTypeReuseWhenScriptUnchanged          = 3
	CacheTypeReuseWhenScriptAndParamsUnchanged = 4
)
View Source
const (
	PullPolicyAlways       = "Always"
	PullPolicyIfNotPresent = "IfNotPresent"
	PullPolicyNever        = "Never"
)

Variables

View Source
var (
	// Container 已经停止
	ErrContainerAlreadyStopped = errors.New("container already stopped")
)

Functions

func EncodeArticleCursor

func EncodeArticleCursor(c ArticleCursor) string

EncodeArticleCursor encodes an article cursor to an opaque string.

Types

type AddFileToDatasetRequest

type AddFileToDatasetRequest struct {
	DatasetID int64  `json:"dataset_id,string" binding:"required"`
	ProjectID string `json:"-"`
	Path      string `json:"path" binding:"required"`
	Role      string `json:"role"`
	FileName  string `json:"file_name" gorm:"type:varchar(255)"`
	IsCopy    bool   `json:"is_copy"` // if true, copy the file to the dataset, otherwise just link it
	// data analysis external
	Source string `json:"source"`
}

type AddFileToDatasetResponse

type AddFileToDatasetResponse struct {
	File        *File        `json:"file"`
	DatasetFile *DatasetFile `json:"dataset_file"`
}

type Analysis

type Analysis struct {
	// ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`
	// ProjectID   string `json:"project" gorm:"column:project;type:varchar(255)"`
	ProjectID   int64  `json:"project_id,string" gorm:"column:project_id;type:bigint"`
	AnalysisID  string `json:"analysis_id" gorm:"column:analysis_id;type:varchar(255)"`
	ComponentID string `json:"component_id" gorm:"column:component_id;type:varchar(255)"`
	WorkflowID  string `json:"relation_id" gorm:"column:relation_id;type:varchar(255)"`
	// AnalysisType        string    `json:"analysis_type" gorm:"column:analysis_type;type:varchar(255)"`
	AnalysisName        string    `json:"analysis_name" gorm:"column:analysis_name;type:varchar(255)"`
	InputFile           string    `json:"input_file" gorm:"column:input_file;type:varchar(255)"`
	AnalysisMethod      string    `json:"analysis_method" gorm:"column:analysis_method;type:varchar(255)"`
	WorkDir             string    `json:"work_dir" gorm:"column:work_dir;type:varchar(255)"`
	ParamsPath          string    `json:"params_path" gorm:"column:params_path;type:varchar(255)"`
	CommandPath         string    `json:"command_path" gorm:"column:command_path;type:varchar(255)"`
	RequestParam        string    `json:"request_param" gorm:"column:request_param;type:longtext"`
	OutputFormat        string    `json:"output_format" gorm:"column:output_format;type:longtext"`
	OutputDir           string    `json:"output_dir" gorm:"column:output_dir;type:varchar(255)"`
	PipelineScript      string    `json:"pipeline_script" gorm:"column:pipeline_script;type:varchar(255)"`
	ParseAnalysisModule string    `json:"parse_analysis_module" gorm:"column:parse_analysis_module;type:varchar(255)"`
	TraceFile           string    `json:"trace_file" gorm:"column:trace_file;type:varchar(255)"`
	WorkflowLogFile     string    `json:"workflow_log_file" gorm:"column:workflow_log_file;type:varchar(255)"`
	ExecutorLogFile     string    `json:"executor_log_file" gorm:"column:executor_log_file;type:varchar(255)"`
	ProcessID           string    `json:"process_id" gorm:"column:process_id;type:varchar(255)"`
	ScriptConfigFile    string    `json:"script_config_file" gorm:"column:script_config_file;type:varchar(255)"`
	JobID               string    `json:"job_id" gorm:"column:job_id;type:varchar(255)"`
	Ports               string    `json:"ports" gorm:"column:ports;type:varchar(255)"`
	URL                 string    `json:"url" gorm:"column:url;type:varchar(255)"`
	JobStatus           string    `json:"job_status" gorm:"column:job_status;type:varchar(255)"`
	ServerStatus        string    `json:"server_status" gorm:"column:server_status;type:varchar(255)"`
	CommandLogPath      string    `json:"command_log_path" gorm:"column:command_log_path;type:varchar(255)"`
	IsReport            bool      `json:"is_report" gorm:"column:is_report;default:false"`
	CacheType           int       `json:"cache_type" gorm:"column:cache_type;default:1"`
	Used                bool      `json:"used" gorm:"column:used;default:true"`
	DataComponentIDs    string    `json:"data_component_ids" gorm:"column:data_component_ids;type:text"`
	ExtraProjectIDs     string    `json:"extra_project_ids" gorm:"column:extra_project_ids;type:longtext"`
	CreatedAt           time.Time `json:"created_at" gorm:"column:created_at"`
	UpdatedAt           time.Time `json:"updated_at" gorm:"column:updated_at"`
}

Analysis maps to Python brave's nextflow table.

func (*Analysis) BeforeCreate

func (t *Analysis) BeforeCreate(_ *gorm.DB) error

func (Analysis) TableName

func (Analysis) TableName() string

type AnalysisControllerSaveInput

type AnalysisControllerSaveInput struct {
	RequestParam        map[string]any
	ParseAnalysisResult map[string]any
	DagRuntime          map[string]any
	Project             *Project
	IsRunNode           bool
	IsReport            bool
}

type AnalysisEdge

type AnalysisEdge struct {
	ID             uint   `json:"id" gorm:"primaryKey;autoIncrement"`
	AnalysisEdgeID string `json:"analysis_edge_id" gorm:"column:analysis_edge_id;type:varchar(255)"`
	// AnalysisID     string `json:"analysis_id" gorm:"column:analysis_id;type:varchar(255);index:idx_analysis_edges_analysis_id"`
	AnalysisID int64 `json:"analysis_id,string" gorm:"column:analysis_id;type:bigint"`

	SourceNode   string    `json:"source_node" gorm:"column:source_node;type:varchar(255)"`
	TargetNode   string    `json:"target_node" gorm:"column:target_node;type:varchar(255)"`
	SourceHandle string    `json:"source_handle" gorm:"column:source_handle;type:varchar(255)"`
	TargetHandle string    `json:"target_handle" gorm:"column:target_handle;type:varchar(255)"`
	CreatedAt    time.Time `json:"created_at" gorm:"column:created_at"`
	UpdatedAt    time.Time `json:"updated_at" gorm:"column:updated_at"`
}

AnalysisEdge maps to Python brave's analysis_edges table.

func (AnalysisEdge) TableName

func (AnalysisEdge) TableName() string

type AnalysisNode

type AnalysisNode struct {
	// ID                     uint       `json:"id" gorm:"primaryKey;autoIncrement"`
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	AnalysisNodeID string `json:"analysis_node_id" gorm:"column:analysis_node_id;type:varchar(255)"`
	// ProjectID      string `json:"project_id" gorm:"column:project_id;type:varchar(255);index:idx_analysis_nodes_project_id"`
	ProjectID int64 `json:"project_id,string" gorm:"column:project_id;type:bigint"`
	// AnalysisID string `json:"analysis_id" gorm:"column:analysis_id;type:varchar(255);index:idx_analysis_nodes_analysis_id;index:idx_analysis_nodes_analysis_id_status,priority:1;index:idx_analysis_nodes_analysis_id_node_id,priority:1"`
	AnalysisID int64  `json:"analysis_id,string" gorm:"column:analysis_id;type:bigint"`
	NodeID     string `json:"node_id" gorm:"column:node_id;type:varchar(255);index:idx_analysis_nodes_analysis_id_node_id,priority:2"`
	NodeName   string `json:"node_name" gorm:"column:node_name;type:varchar(255)"`
	SampleID   string `json:"sample_id" gorm:"column:sample_id;type:varchar(255)"`
	// ScriptID       string `json:"script_id" gorm:"column:script_id;type:varchar(255)"`
	ScriptID               int64      `json:"script_id,string" gorm:"column:script_id;type:bigint"`
	InputsPatterns         JSONMap    `json:"inputs_patterns" gorm:"column:inputs_patterns;type:json"`
	ResolvedInputs         JSONMap    `json:"resolved_inputs" gorm:"column:resolved_inputs;type:json"`
	OutputPatterns         JSONMap    `json:"output_patterns" gorm:"column:output_patterns;type:json"`
	ResolvedOutputs        JSONMap    `json:"resolved_outputs" gorm:"column:resolved_outputs;type:json"`
	Params                 JSONMap    `json:"params" gorm:"column:params;type:json"`
	RequestParam           string     `json:"request_param" gorm:"column:request_param;type:longtext"`
	CPU                    int        `json:"cpu" gorm:"column:cpu"`
	Memory                 string     `json:"memory" gorm:"column:memory;type:varchar(64)"`
	Disk                   string     `json:"disk" gorm:"column:disk;type:varchar(64)"`
	GPU                    int        `json:"gpu" gorm:"column:gpu"`
	Status                 string     `json:"status" gorm:"column:status;type:varchar(64);index:idx_analysis_nodes_analysis_id_status,priority:2"`
	ServerStatus           string     `json:"server_status" gorm:"column:server_status;type:varchar(64)"`
	PID                    int        `json:"pid" gorm:"column:pid"`
	JobID                  string     `json:"job_id" gorm:"column:job_id;type:varchar(255)"`
	Executor               string     `json:"executor" gorm:"column:executor;type:varchar(64)"`
	Retry                  int        `json:"retry" gorm:"column:retry;default:0"`
	MaxRetry               int        `json:"max_retry" gorm:"column:max_retry;default:3"`
	ExitCode               int        `json:"exit_code" gorm:"column:exit_code"`
	ErrorMessage           string     `json:"error_message" gorm:"column:error_message;type:text"`
	RerunReason            string     `json:"rerun_reason" gorm:"column:rerun_reason;type:text"`
	InputHash              string     `json:"input_hash" gorm:"column:input_hash;type:varchar(255)"`
	CacheHit               bool       `json:"cache_hit" gorm:"column:cache_hit"`
	UpstreamIDs            JSONSlice  `json:"upstream_ids" gorm:"column:upstream_ids;type:json"`
	DownstreamIDs          JSONSlice  `json:"downstream_ids" gorm:"column:downstream_ids;type:json"`
	InputValidationErrors  JSONSlice  `json:"input_validation_errors" gorm:"column:input_validation_errors;type:json"`
	OutputValidationErrors JSONSlice  `json:"output_validation_errors" gorm:"column:output_validation_errors;type:json"`
	LogPath                string     `json:"log_path" gorm:"column:log_path;type:varchar(255)"`
	WorkspaceDir           string     `json:"workspace_dir" gorm:"column:workspace_dir;type:varchar(255)"`
	OutputDir              string     `json:"output_dir" gorm:"column:output_dir;type:varchar(255)"`
	CommandPath            string     `json:"command_path" gorm:"column:command_path;type:varchar(255)"`
	CommandMD5             string     `json:"command_md5" gorm:"column:command_md5;type:varchar(64)"`
	ParamsPath             string     `json:"params_path" gorm:"column:params_path;type:varchar(255)"`
	ParamsMD5              string     `json:"params_md5" gorm:"column:params_md5;type:varchar(64)"`
	CreationSource         string     `json:"creation_source" gorm:"column:creation_source;type:varchar(32)"`
	StartedAt              *time.Time `json:"started_at" gorm:"column:started_at"`
	FinishedAt             *time.Time `json:"finished_at" gorm:"column:finished_at"`
	CreatedAt              time.Time  `json:"created_at" gorm:"column:created_at"`
	UpdatedAt              time.Time  `json:"updated_at" gorm:"column:updated_at"`
}

AnalysisNode maps to Python brave's analysis_nodes table.

func (*AnalysisNode) BeforeCreate

func (t *AnalysisNode) BeforeCreate(_ *gorm.DB) error

func (AnalysisNode) TableName

func (AnalysisNode) TableName() string

type AnalysisQuery

type AnalysisQuery = AnalysisQuey

AnalysisQuery is an alias of AnalysisQuey for clearer naming in new code.

type AnalysisQuey

type AnalysisQuey struct {
	IDs []int64 `json:"ids,omitempty"`

	ID *int64 `json:"id,string,omitempty"`

	ProjectID int64 `json:"project_id,string,omitempty"`

	AnalysisID string `json:"analysis_id,omitempty"`

	AnalysisName string `json:"analysis_name,omitempty"`

	WorkflowID string `json:"relation_id,omitempty"`

	JobStatus string `json:"job_status,omitempty"`

	ServerStatus string `json:"server_status,omitempty"`

	IsReport *bool `json:"is_report,omitempty"`

	CacheType *int `json:"cache_type,omitempty"`

	SortBy string `json:"sort_by,omitempty"`

	SortOrder string `json:"sort_order,omitempty"`
}

AnalysisQuey defines optional filters and sorting for analysis pagination. Keep the type name for compatibility with existing callers.

func (*AnalysisQuey) GetAnalysisID

func (q *AnalysisQuey) GetAnalysisID() string

func (*AnalysisQuey) GetAnalysisName

func (q *AnalysisQuey) GetAnalysisName() string

func (*AnalysisQuey) GetJobStatus

func (q *AnalysisQuey) GetJobStatus() string

func (*AnalysisQuey) GetServerStatus

func (q *AnalysisQuey) GetServerStatus() string

func (*AnalysisQuey) GetSortColumn

func (q *AnalysisQuey) GetSortColumn() string

func (*AnalysisQuey) GetSortOrder

func (q *AnalysisQuey) GetSortOrder() string

func (*AnalysisQuey) GetWorkflowID

func (q *AnalysisQuey) GetWorkflowID() string

type AppSession

type AppSession struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	UserID    string `json:"user_id" gorm:"type:varchar(36);index;not null"`
	ProjectID int64  `json:"project_id,string" gorm:"column:project_id;type:bigint"`

	AnalysisNodeID int64 `json:"analysis_node_id,string" gorm:"index"`

	AppType string `json:"app_type" gorm:"type:varchar(32);index"`

	ContainerTemplateID int64 `json:"container_template_id,string" gorm:"index;not null"`

	Name string `json:"name" gorm:"type:varchar(255);not null"`

	Status string `json:"status" gorm:"type:varchar(32);index;not null;default:PENDING"`

	WorkspacePath string `json:"workspace_path" gorm:"type:varchar(1024)"`

	LastAccessAt *time.Time `json:"last_access_at"`

	StartedAt *time.Time `json:"started_at"`

	StoppedAt *time.Time `json:"stopped_at"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

AppSession 的状态机 PENDING

↓

CREATING

↓

RUNNING

↓

STOPPED

↓

RESUMING

↓

FAILED

func (*AppSession) BeforeCreate

func (t *AppSession) BeforeCreate(_ *gorm.DB) error

func (AppSession) TableName

func (AppSession) TableName() string

type AppSessionPageQuery

type AppSessionPageQuery struct {
	AnalysisNodeID *int64 `json:"analysis_node_id,string,omitempty"`
	ProjectID      *int64 `json:"project_id,omitempty"`
}

type ArticleCursor

type ArticleCursor struct {
	SortBy string `json:"sort_by"`
	// Value stores the current sort field's value as string.
	Value string `json:"value"`
	// ID is the tiebreaker for stable ordering.
	ID int64 `json:"id"`
}

ArticleCursor is the cursor payload for article pagination. It uses sort_by + value + id to build a stable ordering cursor.

func DecodeArticleCursor

func DecodeArticleCursor(cursor string) (ArticleCursor, error)

DecodeArticleCursor decodes an opaque cursor string.

type AuthToken

type AuthToken struct {
	// Unique identifier of the token
	ID string `json:"id"         gorm:"type:varchar(36);primaryKey"`
	// User ID that owns this token
	UserID string `json:"user_id"    gorm:"type:varchar(36);index;not null"`
	// Token value (JWT or other format)
	Token string `json:"token"      gorm:"type:text;not null"`
	// Token type (access_token, refresh_token)
	TokenType string `json:"token_type" gorm:"type:varchar(50);not null"`
	// Token expiration time
	ExpiresAt time.Time `json:"expires_at"`
	// Whether the token is revoked
	IsRevoked bool `json:"is_revoked" gorm:"default:false"`
	// Creation time of the token
	CreatedAt time.Time `json:"created_at"`
	// Last updated time of the token
	UpdatedAt time.Time `json:"updated_at"`

	// Association relationship
	User *User `json:"user,omitempty" gorm:"foreignKey:UserID"`
}

AuthToken represents an authentication token

type ContainerEvent

type ContainerEvent struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	ContainerInstanceID int64 `json:"container_instance_id,string" gorm:"index;not null"`

	Event string `json:"event" gorm:"type:varchar(64);index;not null"`

	Message string `json:"message" gorm:"type:text"`

	CreatedAt time.Time `json:"created_at"`
}

func (*ContainerEvent) BeforeCreate

func (t *ContainerEvent) BeforeCreate(_ *gorm.DB) error

func (ContainerEvent) TableName

func (ContainerEvent) TableName() string

type ContainerImage

type ContainerImage struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	Name string `json:"name" gorm:"type:varchar(255);not null;index"`

	Tag string `json:"tag" gorm:"type:varchar(128);not null;index"`

	Registry string `json:"registry" gorm:"type:varchar(255);not null"`

	Namespace string `json:"namespace" gorm:"type:varchar(255)"`

	FullName string `json:"full_name" gorm:"type:varchar(512);uniqueIndex;not null"`

	Digest string `json:"digest" gorm:"type:varchar(255);index"`

	Description string `json:"description" gorm:"type:text"`

	Size int64 `json:"size"`

	Status ImageStatus `json:"status" gorm:"type:varchar(32);index;not null;default:pending"`

	PullPolicy string `json:"pull_policy" gorm:"type:varchar(32);index;not null;default:IfNotPresent"`

	LastPullTime *time.Time `json:"last_pull_time"`

	LastError string `json:"last_error" gorm:"type:text"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*ContainerImage) BeforeCreate

func (t *ContainerImage) BeforeCreate(_ *gorm.DB) error

func (ContainerImage) TableName

func (ContainerImage) TableName() string

type ContainerInstance

type ContainerInstance struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	TemplateID int64 `json:"template_id,string" gorm:"index;not null"`

	OwnerType ContainerOwnerType `json:"owner_type" gorm:"type:varchar(30);index;not null"`

	OwnerID int64 `json:"owner_id,string" gorm:"index;not null"`

	RuntimeID string `json:"runtime_id" gorm:"type:varchar(255);index"`

	Name string `json:"name" gorm:"type:varchar(255);not null;index"`

	Status ContainerStatus `json:"status" gorm:"type:varchar(30);index;not null;default:pending"`

	IPAddress       string `json:"ip_address" gorm:"type:varchar(128)"`
	RuntimeNodeName string `json:"runtime_node_name" gorm:"type:varchar(255);index"`

	ExitCode *int `json:"exit_code"`

	StartedAt *time.Time `json:"started_at"`

	FinishedAt *time.Time `json:"finished_at"`

	CreatedAt time.Time `json:"created_at"`

	UpdatedAt time.Time `json:"updated_at"`
}

func (*ContainerInstance) BeforeCreate

func (t *ContainerInstance) BeforeCreate(_ *gorm.DB) error

func (ContainerInstance) TableName

func (ContainerInstance) TableName() string

type ContainerOwnerType

type ContainerOwnerType string
const (
	ContainerOwnerDagNode    ContainerOwnerType = "dag_node"
	ContainerOwnerAppSession ContainerOwnerType = "app_session"
	ContainerOwnerService    ContainerOwnerType = "service"
)

type ContainerSchedulingConstraint

type ContainerSchedulingConstraint struct {
	Type     string   `json:"type"`
	Key      string   `json:"key"`
	Operator string   `json:"operator"`
	Values   []string `json:"values,omitempty"`
}

type ContainerSchedulingSelector

type ContainerSchedulingSelector struct {
	Constraints []ContainerSchedulingConstraint `json:"constraints"`
}

type ContainerSpec

type ContainerSpec struct {
	Image                string
	Entrypoint           []string
	Command              []string
	Env                  map[string]string
	Volumes              []ContainerVolume
	SupplementalGroups   []int64
	SchedulingConstraint *ContainerSchedulingSelector
	User                 string
	Labels               map[string]string

	CPU    float64
	Memory int64

	WorkDir          string
	RuntimeName      string
	RuntimeNamespace string
	WorkloadKind     string
	ExposedPort      int
	ExposeService    bool
}

type ContainerStatus

type ContainerStatus string
const (
	ContainerCreatePending   ContainerStatus = "create_pending"
	ContainerReCreatePending ContainerStatus = "recreate_pending"
	ContainerReCreating      ContainerStatus = "recreating"
	ContainerCreating        ContainerStatus = "creating"
	ContainerRunning         ContainerStatus = "running"
	ContainerPaused          ContainerStatus = "paused"
	ContainerStopPending     ContainerStatus = "stop_pending"
	ContainerStopping        ContainerStatus = "stopping"
	ContainerStartPending    ContainerStatus = "start_pending"
	ContainerStarting        ContainerStatus = "starting"
	ContainerStopped         ContainerStatus = "stopped"
	ContainerDeleted         ContainerStatus = "deleted"
	ContainerFailed          ContainerStatus = "failed"
	ContainerExited          ContainerStatus = "exited"
	ContainerDeletePending   ContainerStatus = "delete_pending"
	ContainerDeleting        ContainerStatus = "deleting"
)

type ContainerTemplate

type ContainerTemplate struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	Name        string `json:"name" gorm:"type:varchar(255);not null;index"`
	Description string `json:"description" gorm:"type:text"`

	Type ContainerTemplateType `json:"type" gorm:"type:varchar(20);index;not null"`

	// Image string // rocker/rstudio:4.4
	ImageID int64 `json:"image_id,string" gorm:"index;not null"`

	Command string `json:"command" gorm:"type:text"`

	CPU    float64 `json:"cpu"`
	Memory int64   `json:"memory"`

	WorkDir string `json:"work_dir" gorm:"type:varchar(512)"`
	Port    int    `json:"port" gorm:"not null;default:8787"`
	AppType string `json:"app_type" gorm:"type:varchar(32);index"`

	Env                  datatypes.JSON `json:"env" gorm:"type:json"`
	Mounts               datatypes.JSON `json:"mounts" gorm:"type:json"`
	Volumes              datatypes.JSON `json:"volumes" gorm:"type:json"`
	SchedulingConstraint datatypes.JSON `json:"scheduling_constraint" gorm:"type:json"`
	Labels               datatypes.JSON `json:"labels" gorm:"type:json"`
	ChangeUID            bool           `json:"change_uid" gorm:"default:false"`

	RLibraryPath      string    `json:"r_library_path" gorm:"type:varchar(512)"`
	PythonLibraryPath string    `json:"python_library_path" gorm:"type:varchar(512)"`
	CondaLibraryPath  string    `json:"conda_library_path" gorm:"type:varchar(512)"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
}

func (*ContainerTemplate) BeforeCreate

func (t *ContainerTemplate) BeforeCreate(_ *gorm.DB) error

func (*ContainerTemplate) GetCondaLibraryPath

func (c *ContainerTemplate) GetCondaLibraryPath() string

func (*ContainerTemplate) GetPythonLibraryPath

func (c *ContainerTemplate) GetPythonLibraryPath() string

func (*ContainerTemplate) GetRLibraryPath

func (c *ContainerTemplate) GetRLibraryPath() string

func (ContainerTemplate) TableName

func (ContainerTemplate) TableName() string

type ContainerTemplateType

type ContainerTemplateType string
const (
	ContainerTemplateWorkflow ContainerTemplateType = "workflow"
	ContainerTemplateApp      ContainerTemplateType = "app"
	ContainerTemplateService  ContainerTemplateType = "service"
)

type ContainerVolume

type ContainerVolume struct {
	Source string
	Target string
	Mode   string
	// Type 可选:值为 "file" 时源路径按文件创建,否则按目录创建。
	Type  string
	Owner string
}

type ContextKey

type ContextKey string

ContextKey defines a type for context keys to avoid string collision

const (
	// TenantIDContextKey is the context key for tenant ID
	TenantIDContextKey ContextKey = "TenantID"
	// TenantInfoContextKey is the context key for tenant information
	TenantInfoContextKey ContextKey = "TenantInfo"
	ReqContextKey        ContextKey = "RequestContext"
	// RequestIDContextKey is the context key for request ID
	RequestIDContextKey ContextKey = "RequestID"
	// LoggerContextKey is the context key for logger
	LoggerContextKey ContextKey = "Logger"
	// UserContextKey is the context key for user information
	UserContextKey ContextKey = "User"
	// UserIDContextKey is the context key for user ID
	UserIDContextKey ContextKey = "UserID"
	// SessionTenantIDContextKey is the context key for session owner's tenant ID.
	// When set (e.g. in pipeline with shared agent), session/message lookups use this instead of TenantIDContextKey.
	SessionTenantIDContextKey ContextKey = "SessionTenantID"
	// EmbedQueryContextKey is the context key for embedding query text
	EmbedQueryContextKey ContextKey = "EmbedQuery"
	// LanguageContextKey is the context key for user language preference (e.g. "zh-CN", "en-US")
	LanguageContextKey ContextKey = "Language"
	// LangfuseTraceContextKey carries the active Langfuse *Trace across the
	// request lifecycle. Defined here (not inside the langfuse package) so
	// that logger.CloneContext can preserve it without importing langfuse.
	LangfuseTraceContextKey ContextKey = "LangfuseTrace"
)

func (ContextKey) String

func (c ContextKey) String() string

String returns the string representation of the context key

type CursorPageResult

type CursorPageResult struct {
	Data       interface{} `json:"data"`
	PageSize   int         `json:"page_size"`
	NextCursor string      `json:"next_cursor,omitempty"`
	HasMore    bool        `json:"has_more"`
	SortBy     string      `json:"sort_by,omitempty"`
}

CursorPageResult represents cursor pagination result.

func NewCursorPageResult

func NewCursorPageResult(page *CursorPagination, data interface{}, nextCursor string, hasMore bool) *CursorPageResult

NewCursorPageResult creates a new cursor pagination result.

type CursorPagination

type CursorPagination struct {
	// Cursor for next page, empty means first page.
	Cursor string `form:"cursor" json:"cursor" binding:"omitempty"`
	// Sort field, for example: published_at, created_at, updated_at.
	SortBy string `form:"sort_by" json:"sort_by" binding:"omitempty"`
	// Page size.
	PageSize int `form:"page_size" json:"page_size" binding:"omitempty,min=1,max=1000"`
}

CursorPagination represents lazy-loading cursor pagination parameters.

func (*CursorPagination) GetPageSize

func (p *CursorPagination) GetPageSize() int

GetPageSize gets the page size, default is 20.

func (*CursorPagination) GetSortBy

func (p *CursorPagination) GetSortBy() string

GetSortBy gets the sort field, default is published_at.

type Dataset

type Dataset struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	DatasetID string `json:"dataset_id" gorm:"type:varchar(255);uniqueIndex;not null"`

	DatasetName string `json:"dataset_name" gorm:"type:varchar(255)"`

	Description string `json:"description" gorm:"type:text"`

	Metadata string `json:"metadata" gorm:"type:text"`

	CreatedAt time.Time `json:"created_at"`

	UpdatedAt time.Time `json:"updated_at"`
}

func (*Dataset) BeforeCreate

func (t *Dataset) BeforeCreate(_ *gorm.DB) error

func (Dataset) TableName

func (Dataset) TableName() string

type DatasetFile

type DatasetFile struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	DatasetID int64 `json:"dataset_id,string" gorm:"index;not null"`

	FileID int64 `json:"file_id,string" gorm:"index;not null"`

	Role string `json:"role" gorm:"type:varchar(64)"`

	CreatedAt time.Time `json:"created_at"`
}

func (*DatasetFile) BeforeCreate

func (t *DatasetFile) BeforeCreate(_ *gorm.DB) error

func (DatasetFile) TableName

func (DatasetFile) TableName() string

type DatasetSample

type DatasetSample struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	DatasetID int64 `json:"dataset_id,string" gorm:"index;not null"`

	SampleID int64 `json:"sample_id,string" gorm:"index;not null"`

	CreatedAt time.Time `json:"created_at"`
}

func (*DatasetSample) BeforeCreate

func (t *DatasetSample) BeforeCreate(_ *gorm.DB) error

func (DatasetSample) TableName

func (DatasetSample) TableName() string

type File

type File struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	FileID string `json:"file_id" gorm:"type:varchar(255);uniqueIndex;not null"`

	FileName string `json:"file_name" gorm:"type:varchar(255)"`

	Path string `json:"path" gorm:"type:text;not null"`

	Format string `json:"format" gorm:"type:varchar(64)"`

	Size int64 `json:"size"`

	MD5 string `json:"md5" gorm:"type:varchar(64);index"`

	Storage string `json:"storage" gorm:"type:varchar(32);default:LOCAL"`

	Description string `json:"description" gorm:"type:text"`

	CreatedAt time.Time `json:"created_at"`

	UpdatedAt time.Time `json:"updated_at"`
}

func (*File) BeforeCreate

func (t *File) BeforeCreate(_ *gorm.DB) error

func (File) TableName

func (File) TableName() string

type FileByProjectRoleGroup

type FileByProjectRoleGroup struct {
	Role string `json:"role"`

	Items []*FileWithDatasetInfo `json:"items"`
}

type FileWithDatasetInfo

type FileWithDatasetInfo struct {
	ID int64 `json:"id,string"`

	FileID string `json:"file_id"`

	FileName string `json:"file_name"`

	Path string `json:"path"`

	Format string `json:"format"`

	Size int64 `json:"size"`

	MD5 string `json:"md5"`

	Storage string `json:"storage"`

	Description string `json:"description"`

	CreatedAt time.Time `json:"created_at"`

	UpdatedAt time.Time `json:"updated_at"`

	DatasetID string `json:"dataset_id"`

	DatasetName string `json:"dataset_name"`

	Role string `json:"role"`
}

type GatewayRoute

type GatewayRoute struct {
	RouteKey string `json:"route_key" gorm:"primaryKey;type:varchar(255)"`

	PathPrefix string `json:"path_prefix" gorm:"type:varchar(512);not null;uniqueIndex"`

	BackendHost string `json:"backend_host" gorm:"type:varchar(255);not null"`
	BackendPort int    `json:"backend_port" gorm:"not null"`

	Metadata datatypes.JSON `json:"metadata" gorm:"type:json"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (GatewayRoute) TableName

func (GatewayRoute) TableName() string

type ImageStatus

type ImageStatus string
const (
	ImageStatusPending  ImageStatus = "pending"
	ImageStatusPulling  ImageStatus = "pulling"
	ImageStatusReady    ImageStatus = "ready"
	ImageStatusFailed   ImageStatus = "failed"
	ImageStatusDeleted  ImageStatus = "deleted"
	ImageStatusDisabled ImageStatus = "disabled"
)

type JSONMap

type JSONMap map[string]any

func (JSONMap) MarshalJSON

func (m JSONMap) MarshalJSON() ([]byte, error)

func (*JSONMap) Scan

func (m *JSONMap) Scan(value any) error

func (JSONMap) Value

func (m JSONMap) Value() (driver.Value, error)

type JSONSlice

type JSONSlice []any

func (JSONSlice) MarshalJSON

func (s JSONSlice) MarshalJSON() ([]byte, error)

func (*JSONSlice) Scan

func (s *JSONSlice) Scan(value any) error

func (JSONSlice) Value

func (s JSONSlice) Value() (driver.Value, error)

type LLMConversation

type LLMConversation struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	ConversationID string `json:"conversation_id" gorm:"type:varchar(64);uniqueIndex;not null"`

	LLMSessionID int64 `json:"llm_session_id,string" gorm:"index;not null"`

	Role string `json:"role" gorm:"type:varchar(32);index;not null"`

	Content string `json:"content" gorm:"type:longtext"`

	Model string `json:"model" gorm:"type:varchar(255)"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

LLMConversation stores a single conversation entry under a session. We intentionally use LLMSessionID instead of GORM associations.

func (*LLMConversation) BeforeCreate

func (t *LLMConversation) BeforeCreate(_ *gorm.DB) error

func (LLMConversation) TableName

func (LLMConversation) TableName() string

type LLMSession

type LLMSession struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	ProjectID int64 `json:"project_id" gorm:"type:bigint;index;not null"`

	Title string `json:"title" gorm:"type:varchar(255)"`

	Status string `json:"status" gorm:"type:varchar(32);index;not null;default:ACTIVE"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

LLMSession stores a chat session and owner scope. Relation with conversation is maintained manually via LLMConversation.LLMSessionID.

func (*LLMSession) BeforeCreate

func (t *LLMSession) BeforeCreate(_ *gorm.DB) error

func (LLMSession) TableName

func (LLMSession) TableName() string

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"    binding:"required,email"`
	Password string `json:"password" binding:"required,min=6"`
}

LoginRequest represents a login request

type LoginResponse

type LoginResponse struct {
	Success      bool   `json:"success"`
	Message      string `json:"message,omitempty"`
	User         *User  `json:"user,omitempty"`
	Token        string `json:"token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

LoginResponse represents a login response

type OIDCAuthURLResponse

type OIDCAuthURLResponse struct {
	Success             bool   `json:"success"`
	ProviderDisplayName string `json:"provider_display_name,omitempty"`
	AuthorizationURL    string `json:"authorization_url,omitempty"`
	State               string `json:"state,omitempty"`
}

type OIDCCallbackResponse

type OIDCCallbackResponse struct {
	Success      bool   `json:"success"`
	Message      string `json:"message,omitempty"`
	User         *User  `json:"user,omitempty"`
	Token        string `json:"token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	IsNewUser    bool   `json:"is_new_user,omitempty"`
}

type OIDCConfigResponse

type OIDCConfigResponse struct {
	Success             bool   `json:"success"`
	Enabled             bool   `json:"enabled"`
	ProviderDisplayName string `json:"provider_display_name,omitempty"`
}

type OIDCUserInfo

type OIDCUserInfo struct {
	Subject  string                 `json:"subject,omitempty"`
	Username string                 `json:"username,omitempty"`
	Email    string                 `json:"email,omitempty"`
	Claims   map[string]interface{} `json:"claims,omitempty"`
}

type OutboxEvent

type OutboxEvent struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	Type string `json:"type" gorm:"type:varchar(128);index;not null"`

	Payload datatypes.JSON `json:"payload" gorm:"type:json;not null"`

	Status string `json:"status" gorm:"type:varchar(32);index;not null;default:pending"` // pending / sent

	SentAt *time.Time `json:"sent_at"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*OutboxEvent) BeforeCreate

func (t *OutboxEvent) BeforeCreate(_ *gorm.DB) error

func (OutboxEvent) TableName

func (OutboxEvent) TableName() string

type PageResult

type PageResult struct {
	Total    int64       `json:"total"`     // Total number of records
	Page     int         `json:"page"`      // Current page number
	PageSize int         `json:"page_size"` // Page size
	Data     interface{} `json:"data"`      // Data
}

PageResult represents the pagination query result

func NewPageResult

func NewPageResult(total int64, page *Pagination, data interface{}) *PageResult

NewPageResult creates a new pagination result

type Pagination

type Pagination struct {
	// Page
	Page int `form:"page"      json:"page"      binding:"omitempty,min=1"`
	// Page size
	PageSize int `form:"page_size" json:"page_size" binding:"omitempty,min=1,max=1000"`
}

Pagination represents the pagination parameters

func (*Pagination) GetPage

func (p *Pagination) GetPage() int

GetPage gets the page number, default is 1

func (*Pagination) GetPageSize

func (p *Pagination) GetPageSize() int

GetPageSize gets the page size, default is 20

func (*Pagination) Limit

func (p *Pagination) Limit() int

Limit gets the limit for database query

func (*Pagination) Offset

func (p *Pagination) Offset() int

Offset gets the offset for database query

type Project

type Project struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`
	// ID           uint           `json:"id" gorm:"primaryKey;autoIncrement"`
	ProjectID    string         `json:"project_id" gorm:"type:varchar(255);uniqueIndex;not null"`
	ProjectName  string         `json:"project_name" gorm:"type:varchar(255)"`
	MetadataForm string         `json:"metadata_form" gorm:"type:text"`
	Research     string         `json:"research" gorm:"type:text"`
	Parameter    string         `json:"parameter" gorm:"type:text"`
	Volumes      datatypes.JSON `json:"volumes" gorm:"type:json"`
	Env          datatypes.JSON `json:"env" gorm:"type:json"`

	Description string    `json:"description" gorm:"type:text"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Project maps to Python brave's t_project table.

func (*Project) BeforeCreate

func (t *Project) BeforeCreate(_ *gorm.DB) error

func (Project) TableName

func (Project) TableName() string

type ProjectDataset

type ProjectDataset struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	ProjectID string `json:"project_id" gorm:"index;not null"`

	DatasetID int64 `json:"dataset_id,string" gorm:"index;not null"`

	CreatedAt time.Time `json:"created_at"`
}

func (*ProjectDataset) BeforeCreate

func (t *ProjectDataset) BeforeCreate(_ *gorm.DB) error

func (ProjectDataset) TableName

func (ProjectDataset) TableName() string

type ProjectListItem

type ProjectListItem struct {
	Project
	ShareCode    string `json:"share_code"`
	ShareEnabled bool   `json:"share_enabled"`
}

ProjectListItem carries a Project together with the sharing settings of the current user, taken from the user_project mapping table.

type ProjectReport

type ProjectReport struct {
	ID        int64     `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`
	ProjectID string    `json:"project_id" gorm:"type:varchar(255);not null;index"`
	Title     string    `json:"title" gorm:"type:varchar(255)"`
	Content   string    `json:"content" gorm:"type:longtext"`
	SortOrder int       `json:"sort_order" gorm:"default:0"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*ProjectReport) BeforeCreate

func (t *ProjectReport) BeforeCreate(_ *gorm.DB) error

func (ProjectReport) TableName

func (ProjectReport) TableName() string

type QueryDataset

type QueryDataset struct {
	ID *int64 `json:"id,string,omitempty"`

	DatasetID string `json:"dataset_id,omitempty"`

	DatasetName string `json:"dataset_name,omitempty"`

	Description string `json:"description,omitempty"`

	Metadata string `json:"metadata,omitempty"`
}

QueryDataset defines optional dataset filters for list/page APIs.

func (*QueryDataset) GetDatasetID

func (q *QueryDataset) GetDatasetID() string

func (*QueryDataset) GetDatasetName

func (q *QueryDataset) GetDatasetName() string

func (*QueryDataset) GetDescription

func (q *QueryDataset) GetDescription() string

func (*QueryDataset) GetMetadata

func (q *QueryDataset) GetMetadata() string

type RegisterRequest

type RegisterRequest struct {
	Username string `json:"username" binding:"required,min=2,max=50"`
	Email    string `json:"email"    binding:"required,email"`
	Password string `json:"password" binding:"required,min=6"`
}

RegisterRequest represents a registration request

type RegisterResponse

type RegisterResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
	User    *User  `json:"user,omitempty"`
}

RegisterResponse represents a registration response

type RequestContext

type RequestContext struct {
	User *User
}

type Sample

type Sample struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	SampleID string `json:"sample_id" gorm:"type:varchar(255);uniqueIndex;not null"`

	SampleName string `json:"sample_name" gorm:"type:varchar(255)"`

	SubjectID string `json:"subject_id" gorm:"type:varchar(255)"`

	GroupName string `json:"group_name" gorm:"type:varchar(255)"`

	Phenotype string `json:"phenotype" gorm:"type:varchar(255)"`

	Metadata string `json:"metadata" gorm:"type:text"`

	Description string `json:"description" gorm:"type:text"`

	CreatedAt time.Time `json:"created_at"`

	UpdatedAt time.Time `json:"updated_at"`
}

func (*Sample) BeforeCreate

func (t *Sample) BeforeCreate(_ *gorm.DB) error

func (Sample) TableName

func (Sample) TableName() string

type SampleFile

type SampleFile struct {
	ID int64 `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`

	SampleID int64 `json:"sample_id,string" gorm:"index;not null"`

	FileID int64 `json:"file_id,string" gorm:"index;not null"`

	Role string `json:"role" gorm:"type:varchar(64)"`

	Lane string `json:"lane" gorm:"type:varchar(32)"`

	Replicate string `json:"replicate" gorm:"type:varchar(32)"`

	CreatedAt time.Time `json:"created_at"`
}

func (*SampleFile) BeforeCreate

func (t *SampleFile) BeforeCreate(_ *gorm.DB) error

func (SampleFile) TableName

func (SampleFile) TableName() string

type SampleWithDatasetInfo

type SampleWithDatasetInfo struct {
	ID int64 `json:"id,string"`

	SampleID string `json:"sample_id"`

	SampleName string `json:"sample_name"`

	SubjectID string `json:"subject_id"`

	GroupName string `json:"group_name"`

	Phenotype string `json:"phenotype"`

	Metadata string `json:"metadata"`

	Description string `json:"description"`

	CreatedAt time.Time `json:"created_at"`

	UpdatedAt time.Time `json:"updated_at"`

	DatasetID string `json:"dataset_id"`

	DatasetName string `json:"dataset_name"`
}

type Script

type Script struct {
	// ID                  uint      `json:"id" gorm:"primaryKey;autoIncrement"`
	ID                  int64  `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`
	StoreID             int64  `json:"store_id,string" gorm:"column:store_id;type:bigint"`
	ProjectID           int64  `json:"project_id,string" gorm:"column:project_id;type:bigint"`
	ScriptID            string `json:"component_id" gorm:"column:component_id;type:varchar(255)"`
	InstallKey          string `json:"install_key" gorm:"type:varchar(255)"`
	ComponentType       string `json:"component_type" gorm:"type:varchar(255)"`
	ComponentName       string `json:"component_name" gorm:"type:varchar(255)"`
	Description         string `json:"description" gorm:"type:longtext"`
	ComponentIDs        string `json:"component_ids" gorm:"type:longtext"`
	Img                 string `json:"img" gorm:"type:varchar(255)"`
	ContainerTemplateID int64  `json:"container_template_id,string" gorm:"column:container_template_id;type:bigint"`
	ToolsContainerID    string `json:"tools_container_id" gorm:"type:text"`
	Prompt              string `json:"prompt" gorm:"type:longtext"`
	IOSchema            string `json:"io_schema" gorm:"column:io_schema;type:longtext"`
	SubContainerID      string `json:"sub_container_id" gorm:"type:varchar(255)"`
	Tags                string `json:"tags" gorm:"type:varchar(255)"`
	FileType            string `json:"file_type" gorm:"type:varchar(255)"`
	ScriptType          string `json:"script_type" gorm:"type:varchar(255)"`
	Category            string `json:"category" gorm:"type:varchar(255);default:default"`
	Content             string `json:"content" gorm:"type:text"`
	OrderIndex          int    `json:"order_index"`
	Position            string `json:"position" gorm:"type:text"`
	Edges               string `json:"edges" gorm:"type:text"`
	URL                 string `json:"url" gorm:"column:url;type:varchar(255)"`

	Version   string    `json:"version" gorm:"type:varchar(255)"`
	Message   string    `json:"message" gorm:"type:longtext"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Script) BeforeCreate

func (t *Script) BeforeCreate(_ *gorm.DB) error

func (Script) TableName

func (Script) TableName() string

type ScriptContainerSnapshot

type ScriptContainerSnapshot struct {
	ScriptID       string `json:"script_id" gorm:"column:script_id"`
	ContainerID    int64  `json:"container_id,string" gorm:"column:container_id"`
	ContainerName  string `json:"container_name" gorm:"column:container_name"`
	ImageID        int64  `json:"image_id,string" gorm:"column:image_id"`
	ContainerImage string `json:"container_image" gorm:"column:container_image"`
	ImageName      string `json:"image_name" gorm:"column:image_name"`
	ImageTag       string `json:"image_tag" gorm:"column:image_tag"`
	ImageStatus    string `json:"image_status" gorm:"column:image_status"`
}

ScriptContainerSnapshot is a read model for analysis node visualization. It flattens script -> container template -> container image fields via SQL join.

type ScriptJSONExportResponse

type ScriptJSONExportResponse struct {
	ScriptID           string           `json:"script_id"`
	Script             map[string]any   `json:"script"`
	ContainerTemplates []map[string]any `json:"container_templates,omitempty"`
}

type ScriptPageQuery

type ScriptPageQuery struct {
	IDs []int64 `json:"ids,omitempty"`

	ID *int64 `json:"id,string,omitempty"`

	ProjectID int64 `json:"project_id,string,omitempty"`

	ScriptID string `json:"script_id,omitempty"`

	ComponentName string `json:"component_name,omitempty"`

	ScriptType string `json:"script_type,omitempty"`

	Category string `json:"category,omitempty"`

	InstallKey string `json:"install_key,omitempty"`

	Tags string `json:"tags,omitempty"`

	Keywords string `json:"keywords,omitempty"`

	ContainerTemplateID *int64 `json:"container_template_id,string,omitempty"`

	SortBy string `json:"sort_by,omitempty"`

	SortOrder string `json:"sort_order,omitempty"`
}

ScriptPageQuery defines optional filters and sorting for script pagination. New query fields should be added here and wired in repository applyFilters.

func (*ScriptPageQuery) GetCategory

func (q *ScriptPageQuery) GetCategory() string

func (*ScriptPageQuery) GetComponentName

func (q *ScriptPageQuery) GetComponentName() string

func (*ScriptPageQuery) GetInstallKey

func (q *ScriptPageQuery) GetInstallKey() string

func (*ScriptPageQuery) GetKeywords

func (q *ScriptPageQuery) GetKeywords() string

func (*ScriptPageQuery) GetScriptID

func (q *ScriptPageQuery) GetScriptID() string

func (*ScriptPageQuery) GetScriptType

func (q *ScriptPageQuery) GetScriptType() string

func (*ScriptPageQuery) GetSortColumn

func (q *ScriptPageQuery) GetSortColumn() string

func (*ScriptPageQuery) GetSortOrder

func (q *ScriptPageQuery) GetSortOrder() string

func (*ScriptPageQuery) GetTags

func (q *ScriptPageQuery) GetTags() string

type ScriptVersion

type ScriptVersion struct {
	Script
	StoreVersion string `json:"store_version"`
}

type Store

type Store struct {
	ID int64 `json:"id,string" gorm:"primaryKey;autoIncrement"`

	// StoreID string `json:"store_id" gorm:"type:varchar(255);index"`
	// AppID       string         `json:"app_id" gorm:"type:varchar(255);index"`
	// workflow script
	StoreType   string         `json:"store_type" gorm:"type:varchar(255);index"`
	Name        string         `json:"name" gorm:"type:varchar(255)"`
	Origin      string         `json:"origin" gorm:"type:varchar(255)"`
	URL         string         `json:"url" gorm:"column:url;type:varchar(255)"`
	Status      string         `json:"status" gorm:"type:varchar(255);index"`
	Path        string         `json:"path" gorm:"type:varchar(255)"`
	PathName    string         `json:"path_name" gorm:"type:varchar(255)"`
	Category    string         `json:"category" gorm:"type:varchar(255);index"`
	Tags        datatypes.JSON `json:"tags" gorm:"type:json"`
	Img         string         `json:"img" gorm:"type:varchar(255)"`
	PublishURLs datatypes.JSON `json:"publish_urls" gorm:"column:publish_urls;type:json"`
	Log         string         `json:"log" gorm:"type:longtext"`

	Version string `json:"version" gorm:"type:varchar(255)"`
	Message string `json:"message" gorm:"type:longtext"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Store) BeforeCreate

func (t *Store) BeforeCreate(_ *gorm.DB) error

func (Store) TableName

func (Store) TableName() string

type StoreDTO

type StoreDTO struct {
	Store
	Installed   bool   `json:"installed"`
	InstalledID string `json:"installed_id,omitempty"`
}

type StorePageQuery

type StorePageQuery struct {
	StoreType string `json:"store_type"`
	Keywords  string `json:"keywords,omitempty"`
	SortBy    string `json:"sort_by,omitempty"`
	SortOrder string `json:"sort_order,omitempty"`
}

StorePageQuery defines required filters for store pagination.

func (*StorePageQuery) GetKeywords

func (q *StorePageQuery) GetKeywords() string

func (*StorePageQuery) GetSortColumn

func (q *StorePageQuery) GetSortColumn() string

func (*StorePageQuery) GetSortOrder

func (q *StorePageQuery) GetSortOrder() string

func (*StorePageQuery) GetStoreType

func (q *StorePageQuery) GetStoreType() string

type UpdateDatasetFileRequest

type UpdateDatasetFileRequest struct {
	DatasetID int64  `json:"dataset_id,string" binding:"required"`
	FileID    int64  `json:"file_id,string" binding:"required"`
	Role      string `json:"role"`
}

UpdateDatasetFileRequest DTO: lookup by DatasetID + FileID, only Role is updatable

type User

type User struct {
	// Unique identifier of the user
	ID string `json:"id"         gorm:"type:varchar(36);primaryKey"`
	// Username of the user
	Username string `json:"username"   gorm:"type:varchar(100);uniqueIndex;not null"`
	// Email address of the user
	Email string `json:"email"      gorm:"type:varchar(255);uniqueIndex;not null"`
	// Hashed password of the user
	PasswordHash string `json:"-"          gorm:"type:varchar(255);not null"`
	// Avatar URL of the user
	Avatar string `json:"avatar"     gorm:"type:varchar(500)"`
	// Tenant ID that the user belongs to
	// TenantID uint64 `json:"tenant_id"  gorm:"index"`
	// Whether the user is active
	IsActive bool `json:"is_active"  gorm:"default:true"`
	// Whether the user can access all tenants (cross-tenant access)
	CanAccessAllTenants bool `json:"can_access_all_tenants" gorm:"default:false"`
	// Creation time of the user
	CreatedAt time.Time `json:"created_at"`
	// Last updated time of the user
	UpdatedAt time.Time `json:"updated_at"`
	// Deletion time of the user
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

User represents a user in the system

func (*User) ToUserInfo

func (u *User) ToUserInfo() *UserInfo

ToUserInfo converts User to UserInfo (without sensitive data)

type UserInfo

type UserInfo struct {
	ID                  string    `json:"id"`
	Username            string    `json:"username"`
	Email               string    `json:"email"`
	Avatar              string    `json:"avatar"`
	TenantID            uint64    `json:"tenant_id"`
	IsActive            bool      `json:"is_active"`
	CanAccessAllTenants bool      `json:"can_access_all_tenants"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
}

UserInfo represents user information for API responses

type UserProject

type UserProject struct {
	ID     uint   `json:"id" gorm:"primaryKey;autoIncrement"`
	UserID string `json:"user_id" gorm:"type:varchar(36);not null;index:idx_user_project_user;uniqueIndex:idx_user_project_unique,priority:1"`
	// ProjectID int64  `json:"project_id,string" gorm:"column:project_id;type:bigint"`
	ProjectID string `` /* 129-byte string literal not displayed */
	IsActive  bool   `json:"is_active" gorm:"default:false"`

	// ShareCode is generated when the owner enables project sharing. Other users
	// can use it to look up the project and gain access.
	ShareCode string `json:"share_code" gorm:"type:varchar(64);index"`
	// ShareEnabled toggles whether the project can be shared via ShareCode.
	ShareEnabled bool      `json:"share_enabled" gorm:"default:false"`
	CreatedAt    time.Time `json:"created_at"`
}

UserProject is a manual many-to-many mapping table between users and projects. We intentionally do not use GORM association tags/relations.

func (UserProject) TableName

func (UserProject) TableName() string

type Workflow

type Workflow struct {
	// ID                 uint           `json:"id" gorm:"primaryKey;autoIncrement"`
	ID                 int64          `json:"id,string" gorm:"primaryKey;type:bigint;autoIncrement:false"`
	ProjectID          int64          `json:"project_id,string" gorm:"column:project_id;type:bigint"`
	StoreID            int64          `json:"store_id,string" gorm:"column:store_id;type:bigint"`
	Name               string         `json:"name" gorm:"type:varchar(255)"`
	Img                string         `json:"img" gorm:"type:varchar(255)"`
	Tags               datatypes.JSON `json:"tags" gorm:"type:json"`
	URL                string         `json:"url" gorm:"column:url;type:varchar(255)"`
	Category           string         `json:"category" gorm:"type:varchar(255);default:default"`
	Description        string         `json:"description" gorm:"type:longtext"`
	Prompt             string         `json:"prompt" gorm:"type:longtext"`
	DagDefinition      string         `json:"dag_definition" gorm:"column:dag_definition;type:longtext"`
	WorkflowID         string         `json:"relation_id" gorm:"column:relation_id;type:varchar(255)"`
	RelationType       string         `json:"relation_type" gorm:"type:varchar(255)"`
	InstallKey         string         `json:"install_key" gorm:"type:varchar(255)"`
	ModuleID           string         `json:"component_id" gorm:"column:component_id;type:varchar(255)"`
	ContainerID        string         `json:"container_id" gorm:"type:varchar(255)"`
	ParentComponentID  string         `json:"parent_component_id" gorm:"type:varchar(255)"`
	InputComponentIDs  datatypes.JSON `json:"input_component_ids" gorm:"type:json"`
	OutputComponentIDs datatypes.JSON `json:"output_component_ids" gorm:"type:json"`
	OrderIndex         int            `json:"order_index"`
	Version            string         `json:"version" gorm:"type:varchar(255)"`
	Message            string         `json:"message" gorm:"type:longtext"`
	CreatedAt          time.Time      `json:"created_at"`
	UpdatedAt          time.Time      `json:"updated_at"`
}

func (*Workflow) BeforeCreate

func (t *Workflow) BeforeCreate(_ *gorm.DB) error

func (Workflow) TableName

func (Workflow) TableName() string

type WorkflowJSONExportResponse

type WorkflowJSONExportResponse struct {
	// Path               string           `json:"path"`
	WorkflowID         string           `json:"workflow_id"`
	Workflow           map[string]any   `json:"workflow"`
	Scripts            []map[string]any `json:"scripts"`
	ContainerTemplates []map[string]any `json:"container_templates"`
}

type WorkflowPageQuery

type WorkflowPageQuery struct {
	IDs []uint `json:"ids,omitempty"`

	ID *uint `json:"id,omitempty"`

	ProjectID int64 `json:"project_id,string,omitempty"`

	WorkflowID string `json:"workflow_id,omitempty"`

	Name string `json:"name,omitempty"`

	Category string `json:"category,omitempty"`

	InstallKey string `json:"install_key,omitempty"`

	ModuleID string `json:"module_id,omitempty"`

	RelationType string `json:"relation_type,omitempty"`

	Tags string `json:"tags,omitempty"`

	Keywords string `json:"keywords,omitempty"`

	SortBy string `json:"sort_by,omitempty"`

	SortOrder string `json:"sort_order,omitempty"`
}

WorkflowPageQuery defines optional filters and sorting for workflow pagination.

func (*WorkflowPageQuery) GetCategory

func (q *WorkflowPageQuery) GetCategory() string

func (*WorkflowPageQuery) GetInstallKey

func (q *WorkflowPageQuery) GetInstallKey() string

func (*WorkflowPageQuery) GetKeywords

func (q *WorkflowPageQuery) GetKeywords() string

func (*WorkflowPageQuery) GetModuleID

func (q *WorkflowPageQuery) GetModuleID() string

func (*WorkflowPageQuery) GetName

func (q *WorkflowPageQuery) GetName() string

func (*WorkflowPageQuery) GetRelationType

func (q *WorkflowPageQuery) GetRelationType() string

func (*WorkflowPageQuery) GetSortColumn

func (q *WorkflowPageQuery) GetSortColumn() string

func (*WorkflowPageQuery) GetSortOrder

func (q *WorkflowPageQuery) GetSortOrder() string

func (*WorkflowPageQuery) GetTags

func (q *WorkflowPageQuery) GetTags() string

func (*WorkflowPageQuery) GetWorkflowID

func (q *WorkflowPageQuery) GetWorkflowID() string

type WorkflowVersion

type WorkflowVersion struct {
	// ID                 int64          `json:"id,string"`
	// ProjectID          int64          `json:"project_id,string"`
	// StoreID            int64          `json:"store_id,string"`
	// Name               string         `json:"name"`
	// Img                string         `json:"img"`
	// Tags               datatypes.JSON `json:"tags"`
	// URL                string         `json:"url"`
	// Category           string         `json:"category"`
	// Description        string         `json:"description"`
	// Prompt             string         `json:"prompt"`
	// DagDefinition      string         `json:"dag_definition"`
	// WorkflowID         string         `json:"relation_id"`
	// RelationType       string         `json:"relation_type"`
	// InstallKey         string         `json:"install_key"`
	// ModuleID           string         `json:"component_id"`
	// ContainerID        string         `json:"container_id"`
	// ParentComponentID  string         `json:"parent_component_id"`
	// InputComponentIDs  datatypes.JSON `json:"input_component_ids"`
	// OutputComponentIDs datatypes.JSON `json:"output_component_ids"`
	// OrderIndex         int            `json:"order_index"`
	// Version            string         `json:"version"`
	// UpdateInfo         string         `json:"update_info"`
	// CreatedAt          time.Time      `json:"created_at"`
	// UpdatedAt          time.Time      `json:"updated_at"`
	Workflow
	StoreVersion string `json:"store_version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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