response

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultFormatter

type DefaultFormatter struct{}

func (DefaultFormatter) Format

func (DefaultFormatter) Format(code int, message string, data any, traceID string) any

type Encoder

type Encoder interface {
	Encode(ctx *fasthttp.RequestCtx, statusCode int, payload any) error
}

type Envelope

type Envelope struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
	TraceID string `json:"trace_id,omitempty"`
}

type Formatter

type Formatter interface {
	Format(code int, message string, data any, traceID string) any
}

type JSONEncoder

type JSONEncoder struct{}

func (JSONEncoder) Encode

func (JSONEncoder) Encode(ctx *fasthttp.RequestCtx, statusCode int, payload any) error

type Manager

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

func NewManager

func NewManager(formatter Formatter, encoder Encoder) *Manager

func (*Manager) Write

func (m *Manager) Write(ctx *fasthttp.RequestCtx, statusCode int, code int, message string, data any, traceID string) error

func (*Manager) WriteRaw

func (m *Manager) WriteRaw(ctx *fasthttp.RequestCtx, statusCode int, payload any) error

Jump to

Keyboard shortcuts

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