core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const BrowsePageSize = 25

Variables

This section is empty.

Functions

This section is empty.

Types

type Focus

type Focus uint8
const (
	FocusSchema Focus = iota
	FocusWorkspace
	FocusQueryLog
	FocusChat
)

type Query

type Query struct {
	RequestID uint64
	Context   context.Context
	Service   sharedsql.Service
	Statement string
}

type State

type State uint8
const (
	StateConnection State = iota
	StatePicking
	StateOpening
	StateReady
	StateFailure
)

type Tab

type Tab uint8
const (
	TabSQL Tab = iota
	TabBrowse
	TabStructure
	TabIndexes
	TabForeignKeys
	TabDiagram
	// TabCustom marks that a driver-advertised custom workspace view is
	// active instead of a standard tab; the view's id lives in the
	// workbench's workspace-view state. The standard tab policy never
	// selects it directly.
	TabCustom
)

type Workflow

type Workflow struct {
	State           State
	Focus           Focus
	Tab             Tab
	Target          string
	Status          string
	ReadOnly        bool
	Database        sharedsql.Service
	SelectedTable   string
	WorkspaceTarget WorkspaceTarget
	BrowsePage      int
	// contains filtered or unexported fields
}

func New

func New(target string) Workflow

func (*Workflow) BeginOpening

func (w *Workflow) BeginOpening(target, status string)

func (*Workflow) CancelQuery

func (w *Workflow) CancelQuery()

func (*Workflow) ChangeBrowsePage

func (w *Workflow) ChangeBrowsePage(delta int) bool

func (*Workflow) Fail

func (w *Workflow) Fail(status string)

func (*Workflow) FinishQuery

func (w *Workflow) FinishQuery() (canceled, quit bool)

func (*Workflow) MatchesQuery

func (w *Workflow) MatchesQuery(requestID uint64) bool

func (*Workflow) Opened

func (w *Workflow) Opened(target string, service sharedsql.Service, status string)

func (*Workflow) RecoverToPicker

func (w *Workflow) RecoverToPicker(status string)

func (*Workflow) RequestQuit

func (w *Workflow) RequestQuit()

func (*Workflow) Running

func (w *Workflow) Running() bool

func (*Workflow) SelectDatabase

func (w *Workflow) SelectDatabase(database string)

SelectDatabase opens a database scope: the table selection is cleared, the target set, and the workspace lands on the Browse tab.

func (*Workflow) SelectSchema

func (w *Workflow) SelectSchema(database, schema string)

SelectSchema opens a schema scope: the table selection is cleared, the target set, and the workspace lands on the Browse tab.

func (*Workflow) SelectTable

func (w *Workflow) SelectTable(table string)

SelectTable opens the qualified table in the workspace: the table target is set, SelectedTable retained for the existing table features, the browse page reset, and the workspace focused on the structure tab.

func (*Workflow) StartQuery

func (w *Workflow) StartQuery(ctx context.Context, statement string) (Query, bool)

func (*Workflow) StartQueryForTest

func (w *Workflow) StartQueryForTest(ctx context.Context) uint64

func (*Workflow) StatusRevision

func (w *Workflow) StatusRevision() uint64

StatusRevision returns a counter incremented on every Status write through the workflow methods, so callers can observe a status event even when the text is identical to the previous one.

type WorkspaceTarget

type WorkspaceTarget struct {
	Kind     WorkspaceTargetKind
	Database string
	Schema   string
	Table    string
}

WorkspaceTarget is the workspace's active scope: no selection, a database, a PostgreSQL schema, or a qualified table/collection. The tab policy derives the visible tabs from it; SelectedTable mirrors the table kind for the existing table features.

type WorkspaceTargetKind

type WorkspaceTargetKind uint8

WorkspaceTargetKind is the sidebar scope the workspace tabs serve.

const (
	WorkspaceNone WorkspaceTargetKind = iota
	WorkspaceDatabase
	WorkspaceSchema
	WorkspaceTable
)

Jump to

Keyboard shortcuts

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