controllers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BusEventSettingsUpdated = "settings.updated"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnsController

type ColumnsController struct {
	// contains filtered or unexported fields
}

func NewColumnsController

func NewColumnsController(eventBus *bus.Bus) *ColumnsController

func (*ColumnsController) AddColumn

func (cc *ColumnsController) AddColumn(afterIndex int) tea.Msg

func (*ColumnsController) Columns

func (cc *ColumnsController) Columns() *columns.Columns

func (*ColumnsController) DeleteColumn

func (cc *ColumnsController) DeleteColumn(afterIndex int) tea.Msg

func (*ColumnsController) SetColumnsToResultSet

func (cc *ColumnsController) SetColumnsToResultSet() tea.Msg

func (*ColumnsController) ShiftColumnLeft

func (cc *ColumnsController) ShiftColumnLeft(idx int) tea.Msg

func (*ColumnsController) ShiftColumnRight

func (cc *ColumnsController) ShiftColumnRight(idx int) tea.Msg

func (*ColumnsController) ToggleVisible

func (cc *ColumnsController) ToggleVisible(idx int) tea.Msg

type ColumnsUpdated

type ColumnsUpdated struct {
}

type CustomKeyBindingSource

type CustomKeyBindingSource interface {
	LookupBinding(theKey string) string
	CustomKeyCommand(key string) tea.Cmd
	UnbindKey(key string)
	Rebind(bindingName string, newKey string) error
}

type ExportController

type ExportController struct {
	// contains filtered or unexported fields
}

func NewExportController

func NewExportController(state *State, tableService TableReadService, jobsController *JobsController, columns *ColumnsController) *ExportController

func (*ExportController) ExportCSV

func (c *ExportController) ExportCSV(filename string, opts ExportOptions) tea.Msg

type ExportOptions added in v0.3.0

type ExportOptions struct {
	// AllResults returns all results from the table
	AllResults bool
}

type HideColumnOverlay

type HideColumnOverlay struct{}

type JobBuilder

type JobBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewJob

func NewJob[T any](jc *JobsController, description string, job func(ctx context.Context) (T, error)) JobBuilder[T]

func (JobBuilder[T]) OnDone

func (jb JobBuilder[T]) OnDone(fn func(res T) tea.Msg) JobBuilder[T]

func (JobBuilder[T]) OnEither

func (jb JobBuilder[T]) OnEither(fn func(res T, err error) tea.Msg) JobBuilder[T]

func (JobBuilder[T]) OnErr

func (jb JobBuilder[T]) OnErr(fn func(err error) tea.Msg) JobBuilder[T]

func (JobBuilder[T]) Submit

func (jb JobBuilder[T]) Submit() tea.Msg

type JobsController

type JobsController struct {
	// contains filtered or unexported fields
}

func NewJobsController

func NewJobsController(service *jobs.Services, bus *bus.Bus, immediate bool) *JobsController

func (*JobsController) CancelRunningJob

func (js *JobsController) CancelRunningJob(ifNoJobsRunning func() tea.Msg) tea.Msg

func (*JobsController) SetMessageSender

func (js *JobsController) SetMessageSender(msgSender func(msg tea.Msg))

type KeyBindingController

type KeyBindingController struct {
	// contains filtered or unexported fields
}

func NewKeyBindingController

func NewKeyBindingController(service *keybindings.Service, customBindingSource CustomKeyBindingSource) *KeyBindingController

func (*KeyBindingController) LookupCustomBinding

func (kb *KeyBindingController) LookupCustomBinding(key string) tea.Cmd

func (*KeyBindingController) Rebind

func (kb *KeyBindingController) Rebind(bindingName string, newKey string, force bool) tea.Msg

type MarkOp

type MarkOp int
const (
	MarkOpMark MarkOp = iota
	MarkOpUnmark
	MarkOpToggle
)

type MoveLeftmostDisplayedColumnInTableViewBy

type MoveLeftmostDisplayedColumnInTableViewBy int

type NewResultSet

type NewResultSet struct {
	ResultSet *models.ResultSet
	// contains filtered or unexported fields
}

func (NewResultSet) ModeMessage

func (rs NewResultSet) ModeMessage() string

func (NewResultSet) StatusMessage

func (rs NewResultSet) StatusMessage() string

type PromptForTableMsg

type PromptForTableMsg struct {
	Tables     []string
	OnSelected func(tableName string) tea.Msg
}

type ResultSetUpdated

type ResultSetUpdated struct {
	// contains filtered or unexported fields
}

func (ResultSetUpdated) StatusMessage

func (rs ResultSetUpdated) StatusMessage() string

type ScriptController

type ScriptController struct {
	// contains filtered or unexported fields
}

func NewScriptController

func NewScriptController(
	scriptManager *scriptmanager.Service,
	tableReadController *TableReadController,
	settingsController *SettingsController,
	eventBus *bus.Bus,
) *ScriptController

func (*ScriptController) CustomKeyCommand

func (sc *ScriptController) CustomKeyCommand(key string) tea.Cmd

func (*ScriptController) Init

func (sc *ScriptController) Init()

func (*ScriptController) LoadScript

func (sc *ScriptController) LoadScript(filename string) tea.Msg

func (*ScriptController) LookupBinding

func (sc *ScriptController) LookupBinding(theKey string) string

func (*ScriptController) LookupCommand

func (sc *ScriptController) LookupCommand(name string) commandctrl.Command

func (*ScriptController) Rebind

func (sc *ScriptController) Rebind(bindingName string, newKey string) error

func (*ScriptController) RunScript

func (sc *ScriptController) RunScript(filename string) tea.Msg

func (*ScriptController) SetMessageSender

func (sc *ScriptController) SetMessageSender(sendMsg func(msg tea.Msg))

func (*ScriptController) UnbindKey

func (sc *ScriptController) UnbindKey(key string)

type SetSelectedColumnInColSelector

type SetSelectedColumnInColSelector int

type SetTableItemView

type SetTableItemView struct {
	ViewIndex int
}

type SettingsController

type SettingsController struct {
	// contains filtered or unexported fields
}

func NewSettingsController

func NewSettingsController(sp SettingsProvider, bus *bus.Bus) *SettingsController

func (*SettingsController) IsReadOnly

func (sc *SettingsController) IsReadOnly() bool

func (*SettingsController) SetSetting

func (sc *SettingsController) SetSetting(name string, value string) tea.Msg

type SettingsProvider

type SettingsProvider interface {
	IsReadOnly() (bool, error)
	SetReadOnly(ro bool) error
	DefaultLimit() (limit int)
	SetDefaultLimit(limit int) error
	ScriptLookupFS() ([]fs.FS, error)
	SetScriptLookupPaths(value string) error
	ScriptLookupPaths() string
}

type SettingsUpdated

type SettingsUpdated struct {
}

type ShowColumnOverlay

type ShowColumnOverlay struct{}

type State

type State struct {
	// contains filtered or unexported fields
}

func NewState

func NewState() *State

func (*State) Filter

func (s *State) Filter() string

func (*State) ResultSet

func (s *State) ResultSet() *models.ResultSet

type TableReadController

type TableReadController struct {
	// contains filtered or unexported fields
}

func NewTableReadController

func NewTableReadController(
	state *State,
	tableService TableReadService,
	workspaceService *viewsnapshot.ViewSnapshotService,
	itemRendererService *itemrenderer.Service,
	jobController *JobsController,
	inputHistoryService *inputhistory.Service,
	eventBus *bus.Bus,
	tableName string,
) *TableReadController

func (*TableReadController) CopyItemToClipboard

func (c *TableReadController) CopyItemToClipboard(idx int) tea.Msg

func (*TableReadController) Filter

func (c *TableReadController) Filter() tea.Msg

func (*TableReadController) Init

func (c *TableReadController) Init() tea.Msg

Init does an initial scan of the table. If no table is specified, it prompts for a table, then does a scan.

func (*TableReadController) ListTables

func (c *TableReadController) ListTables(quitIfNoTable bool) tea.Msg

func (*TableReadController) Mark

func (c *TableReadController) Mark(op MarkOp) tea.Msg

func (*TableReadController) NextPage

func (c *TableReadController) NextPage() tea.Msg

func (*TableReadController) PromptForQuery

func (c *TableReadController) PromptForQuery() tea.Msg

func (*TableReadController) Rescan

func (c *TableReadController) Rescan() tea.Msg

func (*TableReadController) ScanTable

func (c *TableReadController) ScanTable(name string) tea.Msg

func (*TableReadController) ViewBack

func (c *TableReadController) ViewBack() tea.Msg

func (*TableReadController) ViewForward

func (c *TableReadController) ViewForward() tea.Msg

type TableReadService

type TableReadService interface {
	ListTables(background context.Context) ([]string, error)
	Describe(ctx context.Context, table string) (*models.TableInfo, error)
	Scan(ctx context.Context, tableInfo *models.TableInfo) (*models.ResultSet, error)
	Filter(resultSet *models.ResultSet, filter string) *models.ResultSet
	ScanOrQuery(ctx context.Context, tableInfo *models.TableInfo, query models.Queryable, exclusiveStartKey map[string]types.AttributeValue) (*models.ResultSet, error)
	NextPage(ctx context.Context, resultSet *models.ResultSet) (*models.ResultSet, error)
}

type TableWriteController

type TableWriteController struct {
	// contains filtered or unexported fields
}

func NewTableWriteController

func NewTableWriteController(
	state *State,
	tableService *tables.Service,
	jobController *JobsController,
	tableReadControllers *TableReadController,
	settingProvider SettingsProvider,
) *TableWriteController

func (*TableWriteController) DeleteAttribute

func (twc *TableWriteController) DeleteAttribute(idx int, key string) tea.Msg

func (*TableWriteController) DeleteMarked

func (twc *TableWriteController) DeleteMarked() tea.Msg

func (*TableWriteController) NewItem

func (twc *TableWriteController) NewItem() tea.Msg

func (*TableWriteController) NoisyTouchItem

func (twc *TableWriteController) NoisyTouchItem(idx int) tea.Msg

func (*TableWriteController) PutItems

func (twc *TableWriteController) PutItems() tea.Msg

func (*TableWriteController) SetAttributeValue

func (twc *TableWriteController) SetAttributeValue(idx int, itemType models.ItemType, key string) tea.Msg

func (*TableWriteController) ToggleMark

func (twc *TableWriteController) ToggleMark(idx int) tea.Msg

func (*TableWriteController) TouchItem

func (twc *TableWriteController) TouchItem(idx int) tea.Msg

type UIStateProvider

type UIStateProvider interface {
	SelectedRowIndex() int
}

Jump to

Keyboard shortcuts

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