summaryrefslogtreecommitdiff
path: root/vendor/github.com/authzed/spicedb/pkg/spiceerrors/util.go
blob: 744e41b9ed57687a40041f492bf357a20cfd30a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package spiceerrors

import (
	"maps"
)

type WithMetadata interface {
	DetailsMetadata() map[string]string
}

// CombineMetadata combines the metadata found on an existing error with that given.
func CombineMetadata(withMetadata WithMetadata, metadata map[string]string) map[string]string {
	clone := maps.Clone(withMetadata.DetailsMetadata())
	for key, value := range metadata {
		clone[key] = value
	}
	return clone
}