Documentation ¶
Index ¶
- func NewPayload(data interface{}, batch bool) *payload
- type Hub
- func (h *Hub) Batch(ctx context.Context, f func(ctx context.Context), shouldLock bool)
- func (h *Hub) DrawCh() chan Payload
- func (h *Hub) PagingCh() chan Payload
- func (h *Hub) QueryCh() chan Payload
- func (h *Hub) SendDraw(ctx context.Context, options interface{})
- func (h *Hub) SendDrawPrompt(ctx context.Context)
- func (h *Hub) SendPaging(ctx context.Context, x interface{})
- func (h *Hub) SendPurgeDisplayCache(ctx context.Context)
- func (h *Hub) SendQuery(ctx context.Context, q string)
- func (h *Hub) SendStatusMsg(ctx context.Context, q string)
- func (h *Hub) SendStatusMsgAndClear(ctx context.Context, q string, clearDelay time.Duration)
- func (h *Hub) StatusMsgCh() chan Payload
- type Payload
- type StatusMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPayload ¶
func NewPayload(data interface{}, batch bool) *payload
Types ¶
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.
func (*Hub) SendDrawPrompt ¶
SendDrawPrompt sends a request to redraw the prompt only
func (*Hub) SendPaging ¶
SendPaging sends a request to move the cursor around
func (*Hub) SendPurgeDisplayCache ¶
func (*Hub) SendStatusMsg ¶
SendStatusMsg sends a string to be displayed in the status message
func (*Hub) SendStatusMsgAndClear ¶
SendStatusMsgAndClear sends a string to be displayed in the status message, as well as a delay until the message should be cleared
func (*Hub) StatusMsgCh ¶
StatusMsgCh returns the channel to update the status message
type Payload ¶
type Payload interface { // Batch returns true if this payload is part of a batch operation. Batch() bool // Data allows you to retrieve the data that's embedded in the payload. Data() interface{} // Done is called when the payload has been processed. There are cases // where the payload processing is expected to be synchronized with the // caller, and this method signals the caller that it is safe to proceed // to whatever next action it was expecting Done() }
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