messages

package
v0.0.0-...-0b98263 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Messages = []struct {
	Value  Message
	TSName string
}{
	{Completed, "COMPLETED"},
	{Error, "ERROR"},
	{Warn, "WARN"},
	{Progress, "PROGRESS"},
	{Daemon, "DAEMON"},
	{Document, "DOCUMENT"},
}

Functions

func MessageType

func MessageType(msg Message) string

func Send

func Send[T MessageData](ctx context.Context, msg Message, data *T)

Types

type DaemonMsg

type DaemonMsg struct {
	Name    string `json:"name"`
	Message string `json:"message"`
	Color   string `json:"color"`
}

func NewDaemonMsg

func NewDaemonMsg(name string, message string, color string) *DaemonMsg

func (*DaemonMsg) Instance

func (m *DaemonMsg) Instance() DaemonMsg

type DocumentMsg

type DocumentMsg struct {
	Filename string `json:"filename"`
	Msg      string `json:"msg"`
}

func NewDocumentMsg

func NewDocumentMsg(filename string, msg string) *DocumentMsg

func (*DocumentMsg) Instance

func (m *DocumentMsg) Instance() DocumentMsg

type ErrorMsg

type ErrorMsg struct {
	Address base.Address `json:"address"`
	ErrStr  string       `json:"errStr"`
}

func NewErrorMsg

func NewErrorMsg(err error, addrs ...base.Address) *ErrorMsg

func (*ErrorMsg) Instance

func (m *ErrorMsg) Instance() ErrorMsg

type Message

type Message int
const (
	Completed Message = iota
	Error
	Warn
	Progress
	Daemon
	Document
)

type MessageData

type MessageData interface {
	string | ProgressMsg | DaemonMsg | ErrorMsg | DocumentMsg
}

type ProgressMsg

type ProgressMsg struct {
	Address base.Address `json:"address"`
	Have    int64        `json:"have"`
	Want    int64        `json:"want"`
}

func NewProgressMsg

func NewProgressMsg(have int64, want int64, addrs ...base.Address) *ProgressMsg

func (*ProgressMsg) Instance

func (m *ProgressMsg) Instance() ProgressMsg

Jump to

Keyboard shortcuts

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