merge

package
v0.171.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

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,
	//	}
}

func Slice

func Slice[T any](vss ...[]T) []T
Example
package main

import (
	"go.llib.dev/frameless/pkg/merge"
)

func main() {
	var (
		a       = []int{1, 2, 3}
		b       = []int{7, 8, 9}
		c       = []int{4, 5, 6}
		d []int = nil
	)
	got := merge.Slice(a, b, c, d)
	_ = got // []int{1, 2, 3, 7, 8, 9, 4, 5, 6}
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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