server

package
v1.0.0-pre Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Success(httpCode,msg,data)
	HTTPEVENT_SUCCESS uint8 = 0x00
	// Failure(httpCode,code, msg)
	HTTPEVENT_FAILURE uint8 = 0x01
	// Error(httpCode,msg)
	HTTPEVENT_ERROR uint8 = 0xf0

	// status text default
	DEFAULT_STATUS_TEXT = ""
)

Variables

This section is empty.

Functions

func PutEchoResponder

func PutEchoResponder(r *EchoResponder)

Types

type EchoResponder

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

func GetEchoResponder

func GetEchoResponder(c echo.Context) *EchoResponder

func NewEchoResponder

func NewEchoResponder(c echo.Context) EchoResponder

func (*EchoResponder) Error

func (rd *EchoResponder) Error(httpCode int, msg string) error

func (*EchoResponder) Failure

func (rd *EchoResponder) Failure(httpCode, code int, msg string) error

func (*EchoResponder) ResponseHttp

func (rd *EchoResponder) ResponseHttp(re HttpEvent) error

func (*EchoResponder) Success

func (rd *EchoResponder) Success(httpCode int, msg string, data any) error

type EchoServer

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

web server echo encapsulation

func InitEchoServer

func InitEchoServer() *EchoServer

func (*EchoServer) MountRoute

func (es *EchoServer) MountRoute() router.Route[router.EchoPack]

MountRoute return the default gateway to mount the specified echo instance. The Gateway Routing from prefix==""

func (*EchoServer) SetupEchoServer

func (es *EchoServer) SetupEchoServer(opts ...EchoServerOption)

func (*EchoServer) Start

func (es *EchoServer) Start()

func (*EchoServer) Stop

func (es *EchoServer) Stop()

func (*EchoServer) WithPeer

func (es *EchoServer) WithPeer(p ...any)

func (*EchoServer) WithRoute

func (es *EchoServer) WithRoute(r ...any)

type EchoServerOption

type EchoServerOption func(es *EchoServer)

Functional echo server configuration.

type EmptyData

type EmptyData struct{}

replace nil -> '{}'

type EmptyList

type EmptyList []EmptyData

replace nil -> '[{}]'

type HttpEvent

type HttpEvent struct {
	Type     uint8
	HttpCode int
	Code     int
	Msg      string
	Data     any
}

type Responder

type Responder interface {
	ResponseHttp(re HttpEvent) error
}

type WebServer

type WebServer interface {
	WithPeer(p ...any)  // public set peer
	WithRoute(r ...any) // public set route
	Start()             // starting server
	Stop()              // stopping server
}

WebServer is the basic abstraction for web server. P represents the route pack.

func InitWebServer

func InitWebServer(handler string) WebServer

Jump to

Keyboard shortcuts

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