utils

package
v3.2.0-dev.62 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const OPENZITI_DEFAULT_LOG_FORMAT = "default openziti: %s"
View Source
const OPENZITI_LOG_FORMAT = "openziti: %s"
View Source
const PathSep = "/"

Variables

This section is empty.

Functions

func AdaptLogrusBasedLogging

func AdaptLogrusBasedLogging(lc logger.LoggingClient)

func BuildBaseKey

func BuildBaseKey(keys ...string) string

func ConvertFromMap

func ConvertFromMap(m map[string]any, target any) error

ConvertFromMap uses json to marshal and unmarshal a map into a target type

func ConvertToMap

func ConvertToMap(target any, m *map[string]any) error

ConvertToMap uses json to marshal and unmarshal a target type into a map

func DeepCopy

func DeepCopy(src any, dest any) error

DeepCopy creates a deep copy/clone of a struct by using json to marshal the original struct, and then unmarshal it back into the new copy. Note that this will only copy the exported fields.

func MergeMaps

func MergeMaps(dest map[string]any, src map[string]any)

MergeMaps combines the src map keys and values with the dest map keys and values if the key exists

func MergeValues

func MergeValues(dest any, src any) error

MergeValues combines src with the dest.

func RemoveUnusedSettings

func RemoveUnusedSettings(src any, baseKey string, usedSettingKeys map[string]any) (map[string]any, error)

func SendJsonErrResp added in v3.1.0

func SendJsonErrResp(
	lc logger.LoggingClient,
	writer *echo.Response,
	request *http.Request,
	errKind errors.ErrKind,
	message string,
	err error,
	requestID string) error

SendJsonErrResp puts together the error response packet for the APIs

func SendJsonResp added in v3.1.0

func SendJsonResp(
	lc logger.LoggingClient,
	writer *echo.Response,
	request *http.Request,
	response interface{},
	statusCode int) error

SendJsonResp puts together the response packet for the APIs

func StringSliceToMap

func StringSliceToMap(src []string) map[string]any

func WrapHandler added in v3.1.0

func WrapHandler(handler func(http.ResponseWriter, *http.Request)) echo.HandlerFunc

WrapHandler wraps `handler func(http.ResponseWriter, *http.Request)` into `echo.HandlerFunc`

Types

type LogrusAdaptor

type LogrusAdaptor struct {
	// contains filtered or unexported fields
}

func (*LogrusAdaptor) Fire

func (f *LogrusAdaptor) Fire(e *logrus.Entry) error

func (*LogrusAdaptor) Format

func (f *LogrusAdaptor) Format(entry *logrus.Entry) ([]byte, error)

func (*LogrusAdaptor) Levels

func (f *LogrusAdaptor) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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