utils

package
v0.0.0-...-4845449 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapFromOneTaggedField

func MapFromOneTaggedField(tag string, model interface{}) *orderedmap.OrderedMap

func MapFromTaggedFields

func MapFromTaggedFields(tag string, model interface{}) *orderedmap.OrderedMap

func ProcessPanic

func ProcessPanic(err interface{}, logger log.Logger, logFilePath string) int

func ReplacePlaceholders

func ReplacePlaceholders(path string, placeholders map[string]interface{}) string

func SetField

func SetField(field *StructField, value, target interface{})

func SetFields

func SetFields(fields []*StructField, data *orderedmap.OrderedMap, target interface{})

func SortByName

func SortByName(slice interface{}) interface{}

SortByName - in tests are IDs and sort random -> so we must sort by name.

func StringFromOneTaggedField

func StringFromOneTaggedField(tag string, model interface{}) (str string, found bool)

Types

type MultiError

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

func NewMultiError

func NewMultiError() *MultiError

func (*MultiError) Append

func (e *MultiError) Append(err error)

Append error.

func (*MultiError) AppendWithPrefix

func (e *MultiError) AppendWithPrefix(prefix string, err error)

AppendWithPrefix - add an error with custom prefix.

type NestedError

type NestedError struct {
	*MultiError
	// contains filtered or unexported fields
}

func PrefixError

func PrefixError(msg string, err error) *NestedError

func (*NestedError) Error

func (e *NestedError) Error() (out string)

type PathTemplate

type PathTemplate string

func (PathTemplate) MatchPath

func (p PathTemplate) MatchPath(path string) (bool, map[string]string)

type SafeCounter

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

func NewSafeCounter

func NewSafeCounter(value int) *SafeCounter

func (*SafeCounter) Get

func (c *SafeCounter) Get() int

func (*SafeCounter) GetAndInc

func (c *SafeCounter) GetAndInc() int

func (*SafeCounter) Inc

func (c *SafeCounter) Inc()

func (*SafeCounter) IncAndGet

func (c *SafeCounter) IncAndGet() int

type StructField

type StructField struct {
	reflect.StructField
	// contains filtered or unexported fields
}

func GetFieldsWithTag

func GetFieldsWithTag(tag string, model interface{}) []*StructField

func GetOneFieldWithTag

func GetOneFieldWithTag(tag string, model interface{}) *StructField

func (*StructField) JsonName

func (f *StructField) JsonName() string

type UserError

type UserError struct {
	Message  string
	ExitCode int
}

func NewUserError

func NewUserError(message string) *UserError

func NewUserErrorWithCode

func NewUserErrorWithCode(exitCode int, message string) *UserError

func (*UserError) Error

func (e *UserError) Error() string

Directories

Path Synopsis
Package orderedmap is modified version of: https://github.com/iancoleman/orderedmap
Package orderedmap is modified version of: https://github.com/iancoleman/orderedmap
nolint forbidigo
nolint forbidigo
nolint forbidigo
nolint forbidigo

Jump to

Keyboard shortcuts

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