utils

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgStringD

func ArgStringD(arg, def string) string

func ErrorsBesidesRecordNotFound added in v0.1.29

func ErrorsBesidesRecordNotFound(errs []error) bool

Returns true if there are any errors in the provided array that are NOT a GORM "record not found" error.

func ErrorsToError added in v0.1.29

func ErrorsToError(errs []error) error

func ErrorsToString added in v0.1.29

func ErrorsToString(errs []error) string

func ErrorsToStrings added in v0.1.29

func ErrorsToStrings(errs []error) []string

func ExitError added in v0.1.29

func ExitError(err error)

func ExitErrors added in v0.1.29

func ExitErrors(errs []error)

func ExitSuccess added in v0.1.29

func ExitSuccess()

func IsNotFoundError added in v0.1.30

func IsNotFoundError(err error) bool

Returns true if the provided error is the GORM "record not found" error. Note that this function only returns true on exact matches, so wrapped or flattened errors containing the "record not found" error will not be caught. Given that the GORM "record not found" error is rather generic, handling those cases is too likely to result in false positives. For this reason, the check should be performed before wrapping or flattening any GORM errors using the other helper functions in this file.

func PrependErrors added in v0.1.29

func PrependErrors(errs []error, err error) []error

func RecordNotFound added in v0.1.29

func RecordNotFound(errs []error) bool

Returns true if the provided slice of errors contains a GORM "record not found" error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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