func Merge(errs []Error) Error {
	e := multiError{}
	for _, err := range errs {
		e.errs = append(e.errs, err.Errors()...)
	}
	return e
}
Merge merges multiple Error to single one, but joining all errors together.
NOTE: Nested multi errors are not merged.
package merrors
import (
	"bytes"
	stderrors "errors"
	"fmt"
	"io"
)
type NilOrMultiError struct {
	errs []error
}
func New(errs ...error) *NilOrMultiError {
	m := &NilOrMultiError{}
	m.Add(errs...)
	return m
}
func (e *NilOrMultiError) Add(errs ...error) {
	for _, err := range errs {
		if err == nil {
			continue
		}
		if merr, ok := err.(multiError); ok {
			e.errs = append(e.errs, merr.errs...)
			continue
		}
		e.errs = append(e.errs, err)
	}
}
func (e NilOrMultiError) Err() Error {
	if len(e.errs) == 0 {
		return nil
	}
	return multiError(e)
}
type Error interface {
	error
	Errors() []error
	As(target interface{}) bool
	Is(target error) bool
	Count(target error) int
}
type multiError struct {
	errs []error
}
func (e multiError) Errors() []error {
	return e.errs
}
func (e multiError) Error() string {
	var buf bytes.Buffer
	if len(e.errs) > 1 {
		fmt.Fprintf(&buf, "%d errors: ", len(e.errs))
	}
	for i, err := range e.errs {
		if i != 0 {
			buf.WriteString("; ")
		}
		buf.WriteString(err.Error())
	}
	return buf.String()
}
func (e multiError) As(target interface{}) bool {
	if t, ok := target.(*multiError); ok {
		*t = e
		return true
	}
	for _, err := range e.errs {
		if stderrors.As(err, target) {
			return true
		}
	}
	return false
}
func (e multiError) Is(target error) bool {
	if m, ok := target.(multiError); ok {
		if len(m.errs) != len(e.errs) {
			return false
		}
		for i := 0; i < len(e.errs); i++ {
			if !stderrors.Is(m.errs[i], e.errs[i]) {
				return false
			}
		}
		return true
	}
	for _, err := range e.errs {
		if stderrors.Is(err, target) {
			return true
		}
	}
	return false
}
func (e multiError) Count(target error) (count int) {
	for _, err := range e.errs {
		if inner, ok := AsMulti(err); ok {
			count += inner.Count(target)
			continue
		}
		if stderrors.Is(err, target) {
			count++
		}
	}
	return count
}
func AsMulti(err error) (Error, bool) {
	m := multiError{}
	if !stderrors.As(err, &m) {
		return nil, false
	}
	return m, true
}