Documentation
¶
Index ¶
- type DrawOptions
- type Hub
- func (h *Hub) Batch(ctx context.Context, f func(ctx context.Context))
- func (h *Hub) DrawCh() chan *Payload[*DrawOptions]
- func (h *Hub) PagingCh() chan *Payload[PagingRequest]
- func (h *Hub) QueryCh() chan *Payload[string]
- func (h *Hub) SendDraw(ctx context.Context, options *DrawOptions)
- func (h *Hub) SendDrawPrompt(ctx context.Context)
- func (h *Hub) SendPaging(ctx context.Context, x PagingRequest)
- func (h *Hub) SendQuery(ctx context.Context, q string)
- func (h *Hub) SendStatusMsg(ctx context.Context, q string, clearDelay time.Duration)
- func (h *Hub) StatusMsgCh() chan *Payload[StatusMsg]
- type JumpToLineRequest
- type PagingRequest
- type PagingRequestType
- type Payload
- type StatusMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DrawOptions ¶ added in v0.6.0
type DrawOptions struct {
Prompt bool // draw only the prompt
PurgeCache bool // purge display cache only
RunningQuery bool // a query is currently running
DisableCache bool // disable display cache
ForceSync bool // force a full screen sync
}
DrawOptions controls how the screen is drawn.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub acts as the messaging hub between components -- that is, it controls how the communication that goes through channels are handled.
func (*Hub) Batch ¶
Batch allows you to synchronously send messages during the scope of f() being executed. The mutex is acquired automatically unless this is a nested Batch call (detected via context).
func (*Hub) DrawCh ¶
func (h *Hub) DrawCh() chan *Payload[*DrawOptions]
DrawCh returns the channel to redraw the terminal display
func (*Hub) PagingCh ¶
func (h *Hub) PagingCh() chan *Payload[PagingRequest]
PagingCh returns the channel to page through the results
func (*Hub) SendDraw ¶
func (h *Hub) SendDraw(ctx context.Context, options *DrawOptions)
SendDraw sends a request to redraw the terminal display
func (*Hub) SendDrawPrompt ¶
SendDrawPrompt sends a request to redraw the prompt only
func (*Hub) SendPaging ¶
func (h *Hub) SendPaging(ctx context.Context, x PagingRequest)
SendPaging sends a request to move the cursor around
func (*Hub) SendStatusMsg ¶
SendStatusMsg sends a string to be displayed in the status message. If clearDelay is non-zero, the message will be cleared after that duration.
func (*Hub) StatusMsgCh ¶
StatusMsgCh returns the channel to update the status message
type JumpToLineRequest ¶ added in v0.6.0
type JumpToLineRequest int
JumpToLineRequest is a PagingRequest that jumps to a specific line
func (JumpToLineRequest) Line ¶ added in v0.6.0
func (jlr JumpToLineRequest) Line() int
Line returns the target line number
func (JumpToLineRequest) Type ¶ added in v0.6.0
func (jlr JumpToLineRequest) Type() PagingRequestType
Type satisfies the PagingRequest interface
type PagingRequest ¶ added in v0.6.0
type PagingRequest interface {
Type() PagingRequestType
}
PagingRequest can be sent to move the selection cursor
type PagingRequestType ¶ added in v0.6.0
type PagingRequestType int
PagingRequestType is the type of a paging request
const ( ToLineAbove PagingRequestType = iota // ToLineAbove moves the selection to the line above ToScrollPageDown // ToScrollPageDown moves the selection to the next page ToLineBelow // ToLineBelow moves the selection to the line below ToScrollPageUp // ToScrollPageUp moves the selection to the previous page ToScrollLeft // ToScrollLeft scrolls screen to the left ToScrollRight // ToScrollRight scrolls screen to the right ToLineInPage // ToLineInPage jumps to a particular line on the page ToScrollFirstItem // ToScrollFirstItem ToScrollLastItem // ToScrollLastItem )
func (PagingRequestType) String ¶ added in v0.6.0
func (i PagingRequestType) String() string
func (PagingRequestType) Type ¶ added in v0.6.0
func (prt PagingRequestType) Type() PagingRequestType
Type satisfies the PagingRequest interface for PagingRequestType itself
type Payload ¶
type Payload[T any] struct { // contains filtered or unexported fields }
Payload is a wrapper around the actual request value that needs to be passed. It contains an optional channel field which can be filled to force synchronous communication between the sender and receiver
func NewPayload ¶
NewPayload creates a new Payload with the given data and batch flag.