render

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeByteResponse

func EncodeByteResponse(w http.ResponseWriter, statusCode int, resp []byte)

func EncodeResponse

func EncodeResponse(w http.ResponseWriter, statusCode int, resp any)

Types

type SSEErrCode

type SSEErrCode string
const (
	InternalServiceErr SSEErrCode = "INTERNAL_SERVER_ERROR"
)

type SSEErrorData

type SSEErrorData struct {
	Code    SSEErrCode `json:"code"`
	Message string     `json:"message,omitempty"`
}

type SSEEvent

type SSEEvent struct {
	Type string `json:"type"`
	Data any    `json:"data"`
}

func NewErrorEvent

func NewErrorEvent(data any) SSEEvent

type SSEStream

type SSEStream struct {
	// contains filtered or unexported fields
}

func NewSSEStream

func NewSSEStream(ctx context.Context, w http.ResponseWriter) (*SSEStream, error)

func (*SSEStream) Close

func (s *SSEStream) Close()

func (*SSEStream) Send

func (s *SSEStream) Send(event SSEEvent)

func (*SSEStream) SendError

func (s *SSEStream) SendError(event SSEErrorData)

Jump to

Keyboard shortcuts

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