utils

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ERR_UNRECOVERABLE = "unrecoverable-error"

Variables

View Source
var Upgrader = websocket.Upgrader{
	CheckOrigin: func(r *http.Request) bool {

		return true
	},
}

Functions

func Dbg

func Dbg(ctx context.Context, v string)

func GetContext

func GetContext(r *http.Request) context.Context

func SendError

func SendError(ctx context.Context, w http.ResponseWriter, err error, code string)

func SendError_ws

func SendError_ws(ctx context.Context, c *websocket.Conn, err error, code string)

func SendSuccess

func SendSuccess(ctx context.Context, w http.ResponseWriter, data interface{}, eof bool)

func TimeTrack

func TimeTrack(ctx context.Context, start time.Time)

func TimeTrackTest

func TimeTrackTest(start time.Time)

Types

type Response

type Response struct {
	Status    string      `json:"status"`
	Msg       string      `json:"msg"`
	ErrorCode string      `json:"error-code"`
	Data      interface{} `json:"data"`
	Eof       bool        `json:"eof"`
}

Jump to

Keyboard shortcuts

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