Documentation
¶
Index ¶
- Variables
- func GetMachineID() string
- func InitDB()
- func SaveQueryHistory(entry *QueryHistory) error
- func StoreSetBuildExec(bs *BuildStatus)
- func StoreSetBuildModelExec(ms *BuildModelStatus)
- func StoreSetPipelineExec(pl *sling.Pipeline)
- func StoreSetReplicationExec(t *sling.TaskExecution)
- func ToConfigObject(t *sling.TaskExecution) (task *Task, replication *Replication)
- type BuildModelStatus
- type BuildStatus
- type Execution
- type QueryHistory
- type Replication
- type Setting
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Db is the main databse connection Db *gorm.DB Dbx *sqlx.DB Conn database.Connection // DropAll signifies to drop all tables and recreate them DropAll = false )
View Source
var Store = cmap.New[*Execution]()
Functions ¶
func GetMachineID ¶ added in v1.2.15
func GetMachineID() string
func SaveQueryHistory ¶ added in v1.5.12
func SaveQueryHistory(entry *QueryHistory) error
SaveQueryHistory persists a query history entry
func StoreSetBuildExec ¶ added in v1.6.1
func StoreSetBuildExec(bs *BuildStatus)
func StoreSetBuildModelExec ¶ added in v1.6.1
func StoreSetBuildModelExec(ms *BuildModelStatus)
func StoreSetPipelineExec ¶ added in v1.4.7
func StoreSetReplicationExec ¶ added in v1.4.7
func StoreSetReplicationExec(t *sling.TaskExecution)
Store saves the task into the local sqlite
func ToConfigObject ¶
func ToConfigObject(t *sling.TaskExecution) (task *Task, replication *Replication)
Types ¶
type BuildModelStatus ¶ added in v1.6.1
type BuildModelStatus struct {
ProjectID *string `json:"project_id,omitempty"`
JobID string `json:"job_id,omitempty"`
ExecID string `json:"exec_id,omitempty"`
FileName *string `json:"file_name"`
Target string `json:"target,omitempty"`
ModelName string `json:"model_name"`
NodeType string `json:"node_type,omitempty"`
ObjectName string `json:"object_name,omitempty"`
Mode string `json:"mode,omitempty"`
Status sling.ExecStatus `json:"status,omitempty"`
Error *string `json:"error,omitempty"`
Rows uint64 `json:"rows,omitempty"`
Bytes uint64 `json:"bytes,omitempty"`
Order int `json:"order,omitempty"`
Tries int `json:"tries,omitempty"`
NewLines g.LogLines `json:"new_lines,omitempty"`
TimeNs int64 `json:"time_ns,omitempty"`
StartTimeNs *int64 `json:"start_time_ns,omitempty"`
EndTimeNs *int64 `json:"end_time_ns,omitempty"`
TelemetryMap map[string]any `json:"telemetry_map,omitempty"`
Hostname string `json:"hostname,omitempty"`
AgentID string `json:"agent_id,omitempty"`
TryNumber int `json:"try_number,omitempty"`
}
BuildModelStatus is the per-model/seed/test payload.
type BuildStatus ¶ added in v1.6.1
type BuildStatus struct {
ProjectID *string `json:"project_id,omitempty"`
JobID string `json:"job_id,omitempty"`
ExecID string `json:"exec_id,omitempty"`
FileName *string `json:"file_name"`
Target string `json:"target,omitempty"`
Select []string `json:"select,omitempty"`
Exclude []string `json:"exclude,omitempty"`
FullRefresh bool `json:"full_refresh,omitempty"`
Status sling.ExecStatus `json:"status,omitempty"`
Error *string `json:"error,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Version string `json:"version,omitempty"`
ModelCount int `json:"model_count"`
OkCount int `json:"ok_count"`
FailedCount int `json:"failed_count"`
SkippedCount int `json:"skipped_count"`
Rows uint64 `json:"rows,omitempty"`
Bytes uint64 `json:"bytes,omitempty"`
Tries int `json:"tries,omitempty"`
NewLines g.LogLines `json:"new_lines,omitempty"`
TimeNs int64 `json:"time_ns,omitempty"`
StartTimeNs *int64 `json:"start_time_ns,omitempty"`
EndTimeNs *int64 `json:"end_time_ns,omitempty"`
TelemetryMap map[string]any `json:"telemetry_map,omitempty"`
Hostname string `json:"hostname,omitempty"`
AgentID string `json:"agent_id,omitempty"`
TryNumber int `json:"try_number,omitempty"`
}
BuildStatus is the parent-level build run payload
type Execution ¶
type Execution struct {
// ID auto-increments
ID int64 `json:"id,omitempty" gorm:"primaryKey"`
ExecID string `json:"exec_id,omitempty" gorm:"index"`
// StreamID represents the stream inside the replication that is running.
// Is an MD5 construct:`md5(Source, Target, Stream, Object)`.
StreamID string `json:"stream_id,omitempty" sql:"not null" gorm:"index"`
// ConfigMD5 points to config table. not null
TaskMD5 string `json:"task_md5,omitempty" sql:"not null" gorm:"index"`
ReplicationMD5 string `json:"replication_md5,omitempty" sql:"not null" gorm:"index"`
Status sling.ExecStatus `json:"status,omitempty" gorm:"index"`
Err *string `json:"error,omitempty"`
StartTime *time.Time `json:"start_time,omitempty" gorm:"index"`
EndTime *time.Time `json:"end_time,omitempty" gorm:"index"`
Bytes uint64 `json:"bytes,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Output string `json:"output,omitempty" sql:"default ''"`
Rows uint64 `json:"rows,omitempty"`
Pid int `json:"pid,omitempty"`
Version string `json:"version,omitempty"`
// ProjectID represents the project or the repository.
// If .git exists, grab first commit with `git rev-list --max-parents=0 HEAD`.
// if not, use md5 of path of folder. Can be `null` if using task.
ProjectID *string `json:"project_id,omitempty" gorm:"index"`
// FilePath represents the path to a file.
// We would need this to refer back to the same file, even if
// the contents change. So this should just be the relative path
// of the replication.yaml or task.yaml from the root of the project.
// If Ad-hoc from CLI flags, let it be `null`.
FilePath *string `json:"file_path,omitempty" gorm:"index"`
// WorkPath is where the sling process ran from
WorkPath *string `json:"work_path,omitempty"`
CreatedDt time.Time `json:"created_dt,omitempty" gorm:"autoCreateTime"`
UpdatedDt time.Time `json:"updated_dt,omitempty" gorm:"autoUpdateTime"`
Task *Task `json:"task,omitempty" gorm:"-"`
Replication *Replication `json:"replication,omitempty" gorm:"-"`
TaskExec *sling.TaskExecution `json:"-" gorm:"-"`
}
Execution is a task execute in the store. PK = exec_id + stream_id
func ToExecutionObject ¶
func ToExecutionObject(t *sling.TaskExecution) *Execution
Store saves the task into the local sqlite
type QueryHistory ¶ added in v1.5.12
type QueryHistory struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
WorkspaceKey *string `json:"workspace_key" gorm:"index"`
Connection string `json:"connection"`
Query string `json:"query"`
Status string `json:"status"`
DurationMs int64 `json:"duration_ms"`
RowCount int `json:"row_count"`
ErrorMessage string `json:"error_message,omitempty"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime;index"`
}
QueryHistory stores executed query history entries
func GetQueryHistory ¶ added in v1.5.12
func GetQueryHistory(workspaceKey *string, limit, offset int) (entries []QueryHistory, total int64, err error)
GetQueryHistory retrieves query history entries filtered by workspace key
type Replication ¶
type Replication struct {
Name string `json:"name" gorm:"index"`
ProjectID *string `json:"project_id,omitempty" gorm:"index"`
// MD5 is MD5 of Config json string
MD5 string `json:"md5" gorm:"primaryKey"`
Type sling.JobType `json:"type" gorm:"index"`
Config string `json:"config"` // Original config
ID *string `json:"id" gorm:"index"`
CreatedDt time.Time `json:"created_dt" gorm:"autoCreateTime"`
UpdatedDt time.Time `json:"updated_dt" gorm:"autoUpdateTime"`
}
func (*Replication) Scan ¶ added in v1.2.10
func (r *Replication) Scan(value interface{}) error
Scan scan value into Jsonb, implements sql.Scanner interface
type Task ¶
type Task struct {
ProjectID *string `json:"project_id,omitempty" gorm:"index"`
// MD5 is MD5 of Config json string
MD5 string `json:"md5" gorm:"primaryKey"`
Type sling.JobType `json:"type" gorm:"index"`
Config sling.Config `json:"config"`
CreatedDt time.Time `json:"created_dt" gorm:"autoCreateTime"`
UpdatedDt time.Time `json:"updated_dt" gorm:"autoUpdateTime"`
}
Click to show internal directories.
Click to hide internal directories.