util

package
v0.0.0-...-56beac2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTEXT_TIMEOUT = 5 * time.Second
)

Variables

This section is empty.

Functions

func GetContextWithThisTimeout

func GetContextWithThisTimeout(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

func GetContextWithTimeout

func GetContextWithTimeout(ctx context.Context) (context.Context, context.CancelFunc)

func WriteError

func WriteError(w http.ResponseWriter, statusCode int, errorMessage string)

func WriteInternalServerError

func WriteInternalServerError(w http.ResponseWriter)

func WriteJson

func WriteJson(w http.ResponseWriter, res interface{})

func WriteOK

func WriteOK(w http.ResponseWriter)

func WriteStatus

func WriteStatus(w http.ResponseWriter, statusCode int)

func WriteUnauthorized

func WriteUnauthorized(w http.ResponseWriter)

Types

type Result

type Result struct {
	Ok     bool         `json:"ok"`
	Err    *string      `json:"error,omitempty"`
	Result *interface{} `json:"result,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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