base

package
v0.0.1-rc6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const EventStreamMimeType = "text/event-stream"

Variables

This section is empty.

Functions

func CloseWs

func CloseWs(ws *websocket.Conn, message string)

func SaveFiles

func SaveFiles(g *gin.Context, path string) error

func SaveToTarFile

func SaveToTarFile(g *gin.Context, path string) error

SaveToTarFile 保存为tar压缩文件

func Send

func Send(g *gin.Context, v interface{})

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error)

Types

type IBase

type IBase[T any] interface {
	WithCode(code types.Code) IBase[T]
	WithError(err error) IBase[T]
	WithData(data T) IBase[T]
}

func WithCode

func WithCode[T any](code types.Code) IBase[T]

func WithData

func WithData[T any](data T) IBase[T]

func WithError

func WithError[T any](err error) IBase[T]

type SBase

type SBase[T any] struct {
	types.SBase[T]
}

func (*SBase[T]) WithCode

func (r *SBase[T]) WithCode(code types.Code) IBase[T]

func (*SBase[T]) WithData

func (r *SBase[T]) WithData(data T) IBase[T]

func (*SBase[T]) WithError

func (r *SBase[T]) WithError(err error) IBase[T]

Jump to

Keyboard shortcuts

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