types

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResponseJson

func CreateResponseJson(data []byte, id string) string

Types

type Context

type Context struct {
	Logger  logging.Logger
	Context context.Context
	Session *common.AuthSession
	// Connection *websocket.Conn
	Mutex *sync.Mutex

	Write          func([]byte) error
	WriteJSON      func(interface{}) error
	OnDisconnectFn func() error
}

func (Context) OnDisconnect

func (c Context) OnDisconnect() error

type For

type For string
const (
	ForLogs           For = "logs"
	ForJetstreamLogs  For = "jetstram-logs"
	ForResourceUpdate For = "resource-update"
)

type Message

type Message struct {
	For  For            `json:"for"`
	Data map[string]any `json:"data"`
}

type MessageType

type MessageType string
const (
	MessageTypeError    MessageType = "error"
	MessageTypeResponse MessageType = "response"
	MessageTypeInfo     MessageType = "info"
	MessageTypeWarning  MessageType = "warning"
)

type Response

type Response[T any] struct {
	Type MessageType `json:"type"`
	For  For         `json:"for"`

	Data    T      `json:"data"`
	Message string `json:"message"`
	Id      string `json:"id"`
}

Jump to

Keyboard shortcuts

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