 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package merge offers simple tools to combine types like slices, maps, or errors.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶ added in v0.171.1
Error will combine all given non nil error values into a single error value. If no valid error is given, nil is returned. If only a single non-nil error value is given, the error value is returned.
Example ¶
package main
import (
	"errors"
	"go.llib.dev/frameless/pkg/merge"
)
func main() {
	var (
		err1 error = errors.New("first error")
		err2 error = errors.New("second error")
		err3 error = nil
	)
	err := merge.Error(err1, err2, err3)
	errors.Is(err, err1) // true
	errors.Is(err, err2) // true
	errors.Is(err, err3) // true
}
func Map ¶
func Map[K comparable, V any](vss ...map[K]V) map[K]V
Example ¶
package main
import (
	"go.llib.dev/frameless/pkg/merge"
)
func main() {
	var (
		a = map[string]int{"a": 1, "b": 2, "c": 3}
		b = map[string]int{"g": 7, "h": 8, "i": 9}
		c = map[string]int{"d": 4, "e": 5, "f": 6}
		d = map[string]int{"a": 42}
	)
	got := merge.Map(a, b, c, d)
	_ = got
	//
	//	map[string]int{
	//		"a": 42, "b": 2, "c": 3,
	//		"g": 7, "h": 8, "i": 9,
	//		"d": 4, "e": 5, "f": 6,
	//	}
}
Types ¶
This section is empty.
 Click to show internal directories. 
   Click to hide internal directories.