message

package
v0.0.0-...-c164061 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handle(mess Message)
}

Handler is an interface for handling Message types.

type HandlerFunc

type HandlerFunc func(mess Message)

HandlerFunc is a function type that takes a Message as a parameter.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(mess Message)

Handle calls the HandlerFunc with the provided Message.

type Message

type Message []any

Message is a raw representation of a Message as a slice of json.Message.

func New

func New(v ...any) Message

New creates a new Message.

func (Message) Marshal

func (m Message) Marshal() ([]byte, error)

Marshal marshals the Message into a JSON byte slice.

func (*Message) Push

func (m *Message) Push(v any)

Push appends a value to the Message after marshaling it into a JSON Message.

func (*Message) Unmarshal

func (m *Message) Unmarshal(data []byte) error

Unmarshal unmarshals a JSON byte slice into a Message.

func (Message) Values

func (m Message) Values() []any

Values returns the values of the Message as a slice of any.

Jump to

Keyboard shortcuts

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