utils

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 4 Imported by: 12

README

Go Reference GitHub go.mod Go version GitHub release (latest by date) Go Report Card Actions Status

Golang Utils

Provides several helper, used in my projects.

Documentation

Overview

Package utils provides several helper function for golang.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsId

func IsId(id string) bool

IsId returns true if passed id is a UUID version 4.

func NewId

func NewId() string

NewId returns a new UUID in version 4.

Types

type ErrorStack added in v1.0.2

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

ErrorStack handles a collection of errors. Usefull e.g. in loop where you want to get a list of all occured errors.

func NewErrorStack added in v1.0.2

func NewErrorStack() *ErrorStack

NewErrorStack returns a new, empty error stack.

func (*ErrorStack) Append added in v1.0.2

func (stack *ErrorStack) Append(err error)

Append will add passed error to internal list if it's no nil.

func (*ErrorStack) AsError added in v1.0.2

func (stack *ErrorStack) AsError() error

AsError returns nil of there's no error in internal stack or a new erros which contains all existing errors, composed by new line.

func (*ErrorStack) Error added in v1.0.2

func (stack *ErrorStack) Error() string

Error used to fulfill error interface. Returns all existing errors composed by new line or an empty string.

Jump to

Keyboard shortcuts

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