util

package
v0.0.0-...-e91a8f2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CustomJsonErrorHandler

func CustomJsonErrorHandler(err error, c echo.Context)

Fires when error is not explictly handled by Reject Send generic message instead of non-client-facing message

func Debug

func Debug(x interface{}) string

Stringify JSON pretty-print

func DecodeStringMap

func DecodeStringMap(raw []byte) (map[string]any, error)

JSON map convenience func

func Fatal

func Fatal(errs ...error)

Hard-exits with a log statement on error. Only for cases like CLI startup and scripting

func JSON

func JSON(c echo.Context, x any, errs ...error) error

HTTP handler func for JSON

func Json

func Json(x interface{}) ([]byte, error)

Pretty-print for debugging

func NewEcho

func NewEcho(zLog zerolog.Logger) (*echo.Echo, *echotozero.Logger)

NewEcho configures a new API server with message logging but no middleware

func NewGlobalZero

func NewGlobalZero(jsonFormat bool, verbosity int) (zerolog.Logger, string)

NewGlobalZero configures an instanced and global logger Returns logger and logging level string.

When not in JSON mode, fields named "ex" will be pretty-printed.

func Reject

func Reject(c echo.Context, err error) error

HTTP handler func for client-facing errors

Types

type DbConnectSettings

type DbConnectSettings struct {
	DbHost, DbUser, DbPort, DbName, DbPassword string
	TLS                                        bool
}

Represents the portions of a SQL connect string

func (*DbConnectSettings) String

func (c *DbConnectSettings) String() string

Formats settings into a database/sql connection string

type ErrorReturn

type ErrorReturn struct {
	Fail bool   `json:"fail"`
	Msg  string `json:"msg"`
}

Consistent error return for all failures

type MAP

type MAP = map[string]any

convenience alias

Jump to

Keyboard shortcuts

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