helper

package
v0.0.0-...-cc3e003 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixErr            = "ERR"
	PrefixOut            = "OUT"
	PrefixWarn           = "WARN"
	PrefixUncatchableErr = "UNCATCHABLE ERR"
	PrefixDebugOut       = "DEBUG (OUT)"

	LogOutBase = "[%s] (%s) %s\n"
	LogErrBase = "[%s] (%s) %s: %s\n"

	InternalServerError = "Internal server error"
	BadRequest          = "Bad request"

	//DefaultIV = "HotAndSunnyMiami"
	DefaultIV = "FoundDeadInMiami"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

type Helper struct {
	CallerName string
	RespW      http.ResponseWriter
	Request    *http.Request
}

func MakeHelper

func MakeHelper(callerName string, r http.ResponseWriter, request *http.Request) *Helper

func (*Helper) BaseInfo

func (r *Helper) BaseInfo(em string, statusCode int64) responseobjs.BaseInfo

func (*Helper) DebugOut

func (r *Helper) DebugOut(s string, a ...interface{})

func (*Helper) Err

func (r *Helper) Err(msg string, err error)

func (*Helper) ErrRespond

func (r *Helper) ErrRespond(msg string, err error, response string)

func (*Helper) Fatal

func (r *Helper) Fatal(msg string, err error)

func (*Helper) GetCallingPlayer

func (r *Helper) GetCallingPlayer(sendErrorResponseOnError bool) (netobj.Player, error)

func (*Helper) GetGameRequest

func (r *Helper) GetGameRequest() []byte

func (*Helper) InternalErr

func (r *Helper) InternalErr(msg string, err error)

func (*Helper) InternalFatal

func (r *Helper) InternalFatal(msg string, err error)

func (*Helper) InvalidRequest

func (r *Helper) InvalidRequest()

func (*Helper) Out

func (r *Helper) Out(s string, a ...interface{})

func (*Helper) Respond

func (r *Helper) Respond(out []byte, sendErrorResponseOnError bool)

func (*Helper) RespondInsecure

func (r *Helper) RespondInsecure(out []byte, sendErrorResponseOnError bool)

func (*Helper) RespondRaw

func (r *Helper) RespondRaw(out []byte, secureFlag, iv string, sendErrorResponseOnError bool)

func (*Helper) SendCompatibleResponse

func (r *Helper) SendCompatibleResponse(out interface{}, sendErrorResponseOnError bool) error

func (*Helper) SendInsecureResponse

func (r *Helper) SendInsecureResponse(i interface{}) error

func (*Helper) SendResponse

func (r *Helper) SendResponse(i interface{}) error

func (*Helper) Uncatchable

func (r *Helper) Uncatchable(msg string)

func (*Helper) Warn

func (r *Helper) Warn(s string, a ...interface{})

func (*Helper) WarnErr

func (r *Helper) WarnErr(msg string, err error)

Jump to

Keyboard shortcuts

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